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