diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-12-20 21:14:52 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-12-20 21:14:52 +0300 |
commit | 145336ec1d028b9a6c1c39554972ffe0d497e7bb (patch) | |
tree | e2c5f172864b88d25790ef63131b6e929291d028 /templates | |
parent | 425e7f0532bcc420f7a8315e3e9702a44d1c1e73 (diff) | |
parent | d9fd71fa2a82da40a9b58c4ecbc49aed06cb8953 (diff) |
Merge branch 'jp/use-diff-index-in-pre-commit-sample'
The sample pre-commit hook that tries to catch introduction of new
paths that use potentially non-portable characters did not notice
an existing path getting renamed to such a problematic path, when
rename detection was enabled.
* jp/use-diff-index-in-pre-commit-sample:
hooks--pre-commit: detect non-ASCII when renaming
Diffstat (limited to 'templates')
-rwxr-xr-x | templates/hooks--pre-commit.sample | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample index e144712c85..29ed5ee486 100755 --- a/templates/hooks--pre-commit.sample +++ b/templates/hooks--pre-commit.sample @@ -28,7 +28,7 @@ if [ "$allownonascii" != "true" ] && # Note that the use of brackets around a tr range is ok here, (it's # even required, for portability to Solaris 10's /usr/bin/tr), since # the square bracket bytes happen to fall in the designated range. - test $(git diff --cached --name-only --diff-filter=A -z $against | + test $(git diff-index --cached --name-only --diff-filter=A -z $against | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 then cat <<\EOF |