From 420ac3b5d07893fa81a456ffc69b01ef6bb652e4 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Tue, 10 Aug 2010 08:39:13 +0200
Subject: [PATCH] ENH: skip checks in pre-commit hook when no files have
 changed

- this usage can correspond to a 'git commit --amend'
---
 bin/tools/pre-commit-hook | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook
index e3dd386c4c8..b0ca86f0202 100755
--- a/bin/tools/pre-commit-hook
+++ b/bin/tools/pre-commit-hook
@@ -55,6 +55,7 @@ die()
     echo '-----------------------' 1>&2
     echo '' 1>&2
     echo "$@" 1>&2
+    echo '' 1>&2
     exit 1
 }
 
@@ -85,7 +86,12 @@ else
     fileList=$(git diff-index --cached --name-only $against --)
 fi
 
-# echo "files: $fileList" 1>&2
+#
+# no files changed: can skip all the checks
+# this usage can correspond to a 'git commit --amend'
+#
+[ -n "$fileList" ] || exit 0
+
 
 unset badFiles
 # join list of files with this amount of space
-- 
GitLab