File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 77#
88# To enable this hook, rename this file to "pre-commit".
99
10+ if git-rev-parse --verify HEAD > /dev/null 2>&1
11+ then
12+ against=HEAD
13+ else
14+ # Initial commit: diff against an empty tree object
15+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
16+ fi
17+
1018# If you want to allow non-ascii filenames set this variable to true.
1119allownonascii=$( git config hooks.allownonascii)
1220
@@ -17,7 +25,7 @@ if [ "$allownonascii" != "true" ] &&
1725 # Note that the use of brackets around a tr range is ok here, (it's
1826 # even required, for portability to Solaris 10's /usr/bin/tr), since
1927 # the square bracket bytes happen to fall in the designated range.
20- test " $( git diff --cached --name-only --diff-filter=A -z |
28+ test " $( git diff --cached --name-only --diff-filter=A -z $against |
2129 LC_ALL=C tr -d ' [ -~]\0' ) "
2230then
2331 echo " Error: Attempt to add a non-ascii file name."
3543 exit 1
3644fi
3745
38- if git-rev-parse --verify HEAD > /dev/null 2>&1
39- then
40- against=HEAD
41- else
42- # Initial commit: diff against an empty tree object
43- against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
44- fi
45-
4646exec git diff-index --check --cached $against --
You can’t perform that action at this time.
0 commit comments