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