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