diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-02-08 16:22:02 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-08 16:22:02 -0800 |
commit | 7c0524187799431bb336d005b1305174602c0249 (patch) | |
tree | b8ce282095c430e6ce18c6f4625269e2aa1f8db5 | |
parent | 13031f66897277973028c45ec7de89657b804c2d (diff) | |
parent | d9fd71fa2a82da40a9b58c4ecbc49aed06cb8953 (diff) | |
download | git-7c0524187799431bb336d005b1305174602c0249.tar.gz |
Merge branch 'jp/use-diff-index-in-pre-commit-sample' into maint-2.43
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
-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 |