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