git and trailing whitespace


Trailing whitespace sucks. git is only half as much fun when people
have trailing whitespace in their code. diffs get cluttered up by
changes that actually aren't changes. 

Many other project these days enforce pretty rigid whitespace regimes
and I wonder if that would be something to enforce globally on, too?

This is not a question of coding style.  Whatever kind of indenting
you choose, trailing whitespace cleanliness is about making git more
fun without losing anything.

Of course, enforcing this is a controversial issue and there are many
different ways one could implement this:

One could have a receive hook on the server side that refuses commits
with trailing whitespace. One could instead have a commit hook that is
installed by on the client side. One could have one that
automatically removes trailing whitespace on commit. One could have a
combination of these hooks.

Then there is the question what to do with the current repos: add
commits that clean up the whitespace sitaution once and from the on
enforce cleanliness, or just enforce cleanliness on added lines and
leave everything else as it is?

Then there is the question about editors. emacs has stuff like this: vim
has something similar I heard. Not sure if other editors do.

Anyway, Owen said he didn't want to fight this fight. I guess I can
understand that, and I don't really want to fight this fight
either. Nonetheless I think this would be good to have and the least I
can do is mentioning this on desktop-devel and asking for opinions. So
here I go.



Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net           GnuPG 0x1A015CC4

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]