Re: git and trailing whitespace

On Tue, 05.05.09 17:06, Behdad Esfahbod (behdad behdad org) wrote:

> On 05/05/2009 05:00 PM, Lennart Poettering wrote:
>> 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.
>> Opinions?
> The default git pre-commit scripts (disabled by default) has a check for 
> that.  In cairo, we recommend enabling it (by way of chmod +x  
> .git/hooks/pre-commit), but with gtk-docs, it's necessary to turn that 
> off at times.  Something to keep in mind.

Maybe should include a "test -f .git/hooks/pre-commit &&
chmod +x .git/hooks/pre-commit" or so to automatically enable it by
default? Would be an easy change and folks who think they have a right
to override this could just move that file away.

> I personally always do a "git diff" before commit, and look for 
> red-background blocks that represent trailing whitespace and fix them 
> myself.

I just have these lines in my ~/.emacs:

(autoload 'nuke-trailing-whitespace "nuke-trailing-whitespace" nil t)
(add-hook 'write-file-hooks 'nuke-trailing-whitespace)

And then I don't have to think about anything. Except that it breaks
my patches for other peoples' project which don't care about trailing


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]