Skip to content

Commit

Permalink
Merge branch 'rh/template-updates'
Browse files Browse the repository at this point in the history
* rh/template-updates:
  templates: spell ASCII in uppercase in pre-commit hook
  templates: Reformat pre-commit hook's message
  templates: Use heredoc in pre-commit hook
  • Loading branch information
Junio C Hamano committed Jul 25, 2013
2 parents 29143fc + 7b3742f commit dfb78f0
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions templates/hooks--pre-commit.sample
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

# If you want to allow non-ascii filenames set this variable to true.
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config hooks.allownonascii)

# Redirect output to stderr.
exec 1>&2

# Cross platform projects tend to avoid non-ascii filenames; prevent
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
Expand All @@ -31,18 +31,17 @@ if [ "$allownonascii" != "true" ] &&
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
echo "Error: Attempt to add a non-ascii file name."
echo
echo "This can cause problems if you want to work"
echo "with people on other platforms."
echo
echo "To be portable it is advisable to rename the file ..."
echo
echo "If you know what you are doing you can disable this"
echo "check using:"
echo
echo " git config hooks.allownonascii true"
echo
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi

Expand Down

0 comments on commit dfb78f0

Please sign in to comment.