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 7
7
#
8
8
# To enable this hook, rename this file to "pre-commit".
9
9
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
+
10
18
# If you want to allow non-ascii filenames set this variable to true.
11
19
allownonascii=$( git config hooks.allownonascii)
12
20
@@ -17,7 +25,7 @@ if [ "$allownonascii" != "true" ] &&
17
25
# Note that the use of brackets around a tr range is ok here, (it's
18
26
# even required, for portability to Solaris 10's /usr/bin/tr), since
19
27
# 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 |
21
29
LC_ALL=C tr -d ' [ -~]\0' ) "
22
30
then
23
31
echo " Error: Attempt to add a non-ascii file name."
35
43
exit 1
36
44
fi
37
45
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
-
46
46
exec git diff-index --check --cached $against --
You can’t perform that action at this time.
0 commit comments