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