Date: Wed, 29 May 2013 01:26:38 +0200 From: magnum <john.magnum@...hmail.com> To: john-dev@...ts.openwall.com Subject: Re: pre-commit hooks (was: Unify internal form of mscash2 hashes?) On 28 May, 2013, at 23:44 , Sayantan Datta <std2048@...il.com> wrote: > On Tue, May 28, 2013 at 9:31 PM, Frank Dittrich <frank_dittrich@...mail.com> wrote: >> You might want to experiment with a pre-commit hook that automatically >> removes trailing whitespace or spaces before tabs in a *non-public* >> repo, and if it turns out to work without unwanted side effects, enable >> that pre-comkmit hook in the public repo. >> >> >> http://stackoverflow.com/questions/591923/make-git-automatically-remove-trailing-whitespace-before-committing >> >> https://gist.github.com/nomadcoder/663933 > > Works great but there is one problem. It can't remove trailing white spaces from multiple files simultaneously. Which of them all? None of them works as described, I see different problems with all of them. Even after fixing that, there would be one SERIOUS problem left. Consider the following: 1. You made lots of edits 2. You selectively stage SOME of the edits (eg. only some changes to a certain file because you want to stage other changes to a different commit) 3. Commit. Every single one of the example hooks described will re-add ALL of the file after fixing trailing spaces, as opposed to the selectively staged parts. This is absolutely not the wanted behavior, especially if this happens silently. This is a total blocker - forget about all of them. A 100% working, safe, hook script is very very tricky to come up with, especially if you want it compatible with different flavors of sed et al. It's a far better solution IMHO to teach your editor to do the right thing. magnum
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.