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