From 0d61f144a318cd54aa903068cbc40276d1b97d22 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Mon, 2 Mar 2009 22:33:05 +0100 Subject: [PATCH] policy: use git to help avoid trailing white space * HACKING (Avoid trailing white space): Describe how git can help. --- HACKING | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/HACKING b/HACKING index 0675f9c57a..ad3e39f00a 100644 --- 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 -- 2.47.3