You've got that as a git hook?

Ill clean the tree tonight or tomorrow, and then work with Cody after he finds 
whatever bug I just presented him with...

-Ben



On Apr 2, 2013, at 4:55 PM, "Derek Gaston" 
<fried...@gmail.com<mailto:fried...@gmail.com>> wrote:

I recommend running this in the libMesh dir:

find . -name '*.[Chi]' -or -name '*.py' | xargs perl -pli -e 's/\s+$//'

Then adding a commit hook to the repository that never again allows trailing 
whitespace to enter.

Then it doesn't matter if people keep it out using Emacs or a Git pre-commit 
hook... but you won't ever get spurious diffs again.

Like Cody says, we implemented this policy over 2 years ago... and it has been 
working like a champ.

Derek


On Tue, Apr 2, 2013 at 3:09 PM, John Peterson 
<jwpeter...@gmail.com<mailto:jwpeter...@gmail.com>> wrote:



On Tue, Apr 2, 2013 at 2:43 PM, John Peterson 
<jwpeter...@gmail.com<mailto:jwpeter...@gmail.com>> wrote:
On Tue, Apr 2, 2013 at 2:30 PM, Kirk, Benjamin (JSC-EG311) 
<benjamin.kir...@nasa.gov<mailto:benjamin.kir...@nasa.gov>> wrote:
OK, at risk of entering dangerous territory…


I've been using John's recommended git config flags, and have become ashamed of 
the amount of trailing whitespace I leave in source files.

I've played around with emacs' whitespace cleanup stuff but I don't like it 
mainly because it removes all whitespace from a file you edit, generating huge 
diffs.

So I switched to using pre-commit hooks in git.

Name the following script "pre-commit", chmod a+x it, and save it in the 
.git/hooks directory of any git repo where you want to use it.  The great thing 
is that it only cleans up whitespace from *your commit* not the entire file.

Argh, apparently that's not true all :(

I just tested it out on a file in the libmesh repo and it fixed all whitespace 
in the file as well.

Not sure what I was thinking, other than I may have only tested the pre-commit 
hook on files that didn't have whitespace?!

--
John

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net<mailto:Libmesh-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/libmesh-devel


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to