pre-commit hook: only check indentation of those files we're trying to commit and...
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 5 Feb 2009 14:41:21 +0000 (14:41 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 5 Feb 2009 14:41:21 +0000 (14:41 +0000)
hooks/pre-commit.hook

index 1bcb90c..a1d7502 100755 (executable)
@@ -19,7 +19,7 @@ INDENT_PARAMETERS="--braces-on-if-line \
        --indent-level2"
  
 echo "--Checking style--"
-for file in `git-diff-index --name-only HEAD | grep "\.c$"` ; do
+for file in `git-diff-index --cached --name-only HEAD | grep "\.c$"` ; do
     test -f ${file} || continue
     tempfoo=`basename $0`
     newfile=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1