Skip to content

Commit f1e3156

Browse files
Jim Meyeringgitster
authored andcommitted
pre-commit.sample: add comment re tr portability; fix grammar
Add a comment explaining why square brackets around a tr range are not only ok, but actually required in this case. Correct spelling and grammar. Signed-off-by: Jim Meyering <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6426ee6 commit f1e3156

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

templates/hooks--pre-commit.sample

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ allownonascii=$(git config hooks.allownonascii)
1414
# them from being added to the repository. We exploit the fact that the
1515
# printable range starts at the space character and ends with tilde.
1616
if [ "$allownonascii" != "true" ] &&
17+
# Note that the use of brackets around a tr range is ok here, (it's
18+
# even required, for portability to Solaris 10's /usr/bin/tr), since
19+
# the square bracket bytes happen to fall in the designated range.
1720
test "$(git diff --cached --name-only --diff-filter=A -z |
1821
LC_ALL=C tr -d '[ -~]\0')"
1922
then
20-
echo "Error: Attempt to add a non-ascii filename."
23+
echo "Error: Attempt to add a non-ascii file name."
2124
echo
22-
echo "This can cause problems if you want to work together"
23-
echo "with people on other platforms than you."
25+
echo "This can cause problems if you want to work"
26+
echo "with people on other platforms."
2427
echo
25-
echo "To be portable it is adviseable to rename the file ..."
28+
echo "To be portable it is advisable to rename the file ..."
2629
echo
2730
echo "If you know what you are doing you can disable this"
2831
echo "check using:"

0 commit comments

Comments
 (0)