123r

Dependencies:   WNC14A2AInterface

Committer:
JMF
Date:
Wed Apr 19 20:58:54 2017 +0000
Revision:
4:daf182af022b
Parent:
0:2563b0415d1f
json file changes;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 0:2563b0415d1f 1 #!/bin/sh
JMF 0:2563b0415d1f 2 #
JMF 0:2563b0415d1f 3 # An example hook script to verify what is about to be committed.
JMF 0:2563b0415d1f 4 # Called by "git commit" with no arguments. The hook should
JMF 0:2563b0415d1f 5 # exit with non-zero status after issuing an appropriate message if
JMF 0:2563b0415d1f 6 # it wants to stop the commit.
JMF 0:2563b0415d1f 7 #
JMF 0:2563b0415d1f 8 # To enable this hook, rename this file to "pre-commit".
JMF 0:2563b0415d1f 9
JMF 0:2563b0415d1f 10 if git rev-parse --verify HEAD >/dev/null 2>&1
JMF 0:2563b0415d1f 11 then
JMF 0:2563b0415d1f 12 against=HEAD
JMF 0:2563b0415d1f 13 else
JMF 0:2563b0415d1f 14 # Initial commit: diff against an empty tree object
JMF 0:2563b0415d1f 15 against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
JMF 0:2563b0415d1f 16 fi
JMF 0:2563b0415d1f 17
JMF 0:2563b0415d1f 18 # If you want to allow non-ascii filenames set this variable to true.
JMF 0:2563b0415d1f 19 allownonascii=$(git config hooks.allownonascii)
JMF 0:2563b0415d1f 20
JMF 0:2563b0415d1f 21 # Redirect output to stderr.
JMF 0:2563b0415d1f 22 exec 1>&2
JMF 0:2563b0415d1f 23
JMF 0:2563b0415d1f 24 # Cross platform projects tend to avoid non-ascii filenames; prevent
JMF 0:2563b0415d1f 25 # them from being added to the repository. We exploit the fact that the
JMF 0:2563b0415d1f 26 # printable range starts at the space character and ends with tilde.
JMF 0:2563b0415d1f 27 if [ "$allownonascii" != "true" ] &&
JMF 0:2563b0415d1f 28 # Note that the use of brackets around a tr range is ok here, (it's
JMF 0:2563b0415d1f 29 # even required, for portability to Solaris 10's /usr/bin/tr), since
JMF 0:2563b0415d1f 30 # the square bracket bytes happen to fall in the designated range.
JMF 0:2563b0415d1f 31 test $(git diff --cached --name-only --diff-filter=A -z $against |
JMF 0:2563b0415d1f 32 LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
JMF 0:2563b0415d1f 33 then
JMF 0:2563b0415d1f 34 echo "Error: Attempt to add a non-ascii file name."
JMF 0:2563b0415d1f 35 echo
JMF 0:2563b0415d1f 36 echo "This can cause problems if you want to work"
JMF 0:2563b0415d1f 37 echo "with people on other platforms."
JMF 0:2563b0415d1f 38 echo
JMF 0:2563b0415d1f 39 echo "To be portable it is advisable to rename the file ..."
JMF 0:2563b0415d1f 40 echo
JMF 0:2563b0415d1f 41 echo "If you know what you are doing you can disable this"
JMF 0:2563b0415d1f 42 echo "check using:"
JMF 0:2563b0415d1f 43 echo
JMF 0:2563b0415d1f 44 echo " git config hooks.allownonascii true"
JMF 0:2563b0415d1f 45 echo
JMF 0:2563b0415d1f 46 exit 1
JMF 0:2563b0415d1f 47 fi
JMF 0:2563b0415d1f 48
JMF 0:2563b0415d1f 49 # If there are whitespace errors, print the offending file names and fail.
JMF 0:2563b0415d1f 50 exec git diff-index --check --cached $against --