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