@matheusbsbs / matheus-bagliano / commits / f1e3156e62
Fork 0

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 <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jim Meyering committed Sep 21, 2009 at 13:00 UTC f1e3156e627fa66714deea665c8f3585088b9695
1 file changed +7 -4
templates/hooks--pre-commit.sample
+7 -4
@@ -14,15 +14,18 @@ allownonascii=$(git config hooks.allownonascii)
14 # them from being added to the repository. We exploit the fact that the
15 # printable range starts at the space character and ends with tilde.
16 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.
20 test "$(git diff --cached --name-only --diff-filter=A -z |
21 LC_ALL=C tr -d '[ -~]\0')"
22 then
20 - echo "Error: Attempt to add a non-ascii filename."
23 + echo "Error: Attempt to add a non-ascii file name."
24 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."
27 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 ..."
29 echo
30 echo "If you know what you are doing you can disable this"
31 echo "check using:"