my customized lib
atmel-rf-driver/.git/hooks/commit-msg.sample@0:8094b249013c, 2017-11-26 (annotated)
- Committer:
- DuyLionTran
- Date:
- Sun Nov 26 15:08:14 2017 +0000
- Revision:
- 0:8094b249013c
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DuyLionTran | 0:8094b249013c | 1 | #!/bin/sh |
DuyLionTran | 0:8094b249013c | 2 | # |
DuyLionTran | 0:8094b249013c | 3 | # An example hook script to check the commit log message. |
DuyLionTran | 0:8094b249013c | 4 | # Called by "git commit" with one argument, the name of the file |
DuyLionTran | 0:8094b249013c | 5 | # that has the commit message. The hook should exit with non-zero |
DuyLionTran | 0:8094b249013c | 6 | # status after issuing an appropriate message if it wants to stop the |
DuyLionTran | 0:8094b249013c | 7 | # commit. The hook is allowed to edit the commit message file. |
DuyLionTran | 0:8094b249013c | 8 | # |
DuyLionTran | 0:8094b249013c | 9 | # To enable this hook, rename this file to "commit-msg". |
DuyLionTran | 0:8094b249013c | 10 | |
DuyLionTran | 0:8094b249013c | 11 | # Uncomment the below to add a Signed-off-by line to the message. |
DuyLionTran | 0:8094b249013c | 12 | # Doing this in a hook is a bad idea in general, but the prepare-commit-msg |
DuyLionTran | 0:8094b249013c | 13 | # hook is more suited to it. |
DuyLionTran | 0:8094b249013c | 14 | # |
DuyLionTran | 0:8094b249013c | 15 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
DuyLionTran | 0:8094b249013c | 16 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |
DuyLionTran | 0:8094b249013c | 17 | |
DuyLionTran | 0:8094b249013c | 18 | # This example catches duplicate Signed-off-by lines. |
DuyLionTran | 0:8094b249013c | 19 | |
DuyLionTran | 0:8094b249013c | 20 | test "" = "$(grep '^Signed-off-by: ' "$1" | |
DuyLionTran | 0:8094b249013c | 21 | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { |
DuyLionTran | 0:8094b249013c | 22 | echo >&2 Duplicate Signed-off-by lines. |
DuyLionTran | 0:8094b249013c | 23 | exit 1 |
DuyLionTran | 0:8094b249013c | 24 | } |