]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
policy: use git to help avoid trailing white space
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 2 Mar 2009 21:33:05 +0000 (22:33 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 4 Mar 2009 05:19:49 +0000 (06:19 +0100)
* HACKING (Avoid trailing white space): Describe how git can help.

HACKING

diff --git a/HACKING b/HACKING
index 0675f9c57a7a1bbc4f6aaa4e8aa63195896936da..ad3e39f00a1c051d93e4fbff55eb2f67af91a494 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -380,6 +380,25 @@ If you use vim, add this to ~/.vimrc:
     match RedundantSpaces /\s\+$\| \+\ze\t/
 
 
+Git can help too, by stopping you from committing any change that would
+add trailing blanks.  The example pre-commit hook contains code to check
+for trailing whitespace and spaces before tabs; enable it by moving it
+to the right place and making sure it is executable:
+
+    mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
+
+With a repository created by git-1.5.6 or older, use this command:
+
+    chmod +x .git/hooks/pre-commit
+
+To manually check for whitespace errors before committing, you can use
+
+    git diff --check
+
+Git also has some settings to enable suitable internal whitespace checks.
+See the manpage for git-apply for details.
+
+
 -------------------------------------------
 
 Miscellaneous useful git commands