Vergil Cola
/
MQTTGatewayK64
Fork of my MQTTGateway
sd-driver/.git/hooks/prepare-commit-msg.sample@0:f1d3878b8dd9, 2017-04-08 (annotated)
- Committer:
- vpcola
- Date:
- Sat Apr 08 14:45:51 2017 +0000
- Revision:
- 0:f1d3878b8dd9
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vpcola | 0:f1d3878b8dd9 | 1 | #!/bin/sh |
vpcola | 0:f1d3878b8dd9 | 2 | # |
vpcola | 0:f1d3878b8dd9 | 3 | # An example hook script to prepare the commit log message. |
vpcola | 0:f1d3878b8dd9 | 4 | # Called by "git commit" with the name of the file that has the |
vpcola | 0:f1d3878b8dd9 | 5 | # commit message, followed by the description of the commit |
vpcola | 0:f1d3878b8dd9 | 6 | # message's source. The hook's purpose is to edit the commit |
vpcola | 0:f1d3878b8dd9 | 7 | # message file. If the hook fails with a non-zero status, |
vpcola | 0:f1d3878b8dd9 | 8 | # the commit is aborted. |
vpcola | 0:f1d3878b8dd9 | 9 | # |
vpcola | 0:f1d3878b8dd9 | 10 | # To enable this hook, rename this file to "prepare-commit-msg". |
vpcola | 0:f1d3878b8dd9 | 11 | |
vpcola | 0:f1d3878b8dd9 | 12 | # This hook includes three examples. The first comments out the |
vpcola | 0:f1d3878b8dd9 | 13 | # "Conflicts:" part of a merge commit. |
vpcola | 0:f1d3878b8dd9 | 14 | # |
vpcola | 0:f1d3878b8dd9 | 15 | # The second includes the output of "git diff --name-status -r" |
vpcola | 0:f1d3878b8dd9 | 16 | # into the message, just before the "git status" output. It is |
vpcola | 0:f1d3878b8dd9 | 17 | # commented because it doesn't cope with --amend or with squashed |
vpcola | 0:f1d3878b8dd9 | 18 | # commits. |
vpcola | 0:f1d3878b8dd9 | 19 | # |
vpcola | 0:f1d3878b8dd9 | 20 | # The third example adds a Signed-off-by line to the message, that can |
vpcola | 0:f1d3878b8dd9 | 21 | # still be edited. This is rarely a good idea. |
vpcola | 0:f1d3878b8dd9 | 22 | |
vpcola | 0:f1d3878b8dd9 | 23 | case "$2,$3" in |
vpcola | 0:f1d3878b8dd9 | 24 | merge,) |
vpcola | 0:f1d3878b8dd9 | 25 | /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; |
vpcola | 0:f1d3878b8dd9 | 26 | |
vpcola | 0:f1d3878b8dd9 | 27 | # ,|template,) |
vpcola | 0:f1d3878b8dd9 | 28 | # /usr/bin/perl -i.bak -pe ' |
vpcola | 0:f1d3878b8dd9 | 29 | # print "\n" . `git diff --cached --name-status -r` |
vpcola | 0:f1d3878b8dd9 | 30 | # if /^#/ && $first++ == 0' "$1" ;; |
vpcola | 0:f1d3878b8dd9 | 31 | |
vpcola | 0:f1d3878b8dd9 | 32 | *) ;; |
vpcola | 0:f1d3878b8dd9 | 33 | esac |
vpcola | 0:f1d3878b8dd9 | 34 | |
vpcola | 0:f1d3878b8dd9 | 35 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
vpcola | 0:f1d3878b8dd9 | 36 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |