From 3c88b9cd60d903961780dd87ea670c649135eb73 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20R=C3=BChle?= Date: Mon, 25 Dec 2006 22:23:03 +0100 Subject: [PATCH] Prevent case sensitive commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When the index contains files differing only in case this will print their lowercased names to STDERR and exit with non-zero status aborting the commit. Signed-off-by: Jürgen Rühle --- templates/hooks--pre-commit | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit index b25dce6bbf..cf7bd53f38 100644 --- a/templates/hooks--pre-commit +++ b/templates/hooks--pre-commit @@ -7,6 +7,17 @@ # # To enable this hook, make this file executable. +# Detect case challenges + +case_challenge=`git ls-files | tr A-Z a-z | sort | uniq -d` +if [ -n "$case_challenge" ] +then + echo >&2 "index contains file names differing only in case." + echo >&2 "lowercase names follow:" + echo >&2 "$case_challenge" + exit 1 +fi + # This is slightly modified from Andrew Morton's Perfect Patch. # Lines you introduce should not have trailing whitespace. # Also check for an indentation that has SP before a TAB. -- 2.11.4.GIT