Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

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