Pratyush Mallick
/
nano_dac
this is testing
noos_mbed/.git/hooks/prepare-commit-msg.sample@0:e8a1ba50c46b, 2021-01-14 (annotated)
- Committer:
- pmallick
- Date:
- Thu Jan 14 19:12:57 2021 +0530
- Revision:
- 0:e8a1ba50c46b
this is testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pmallick | 0:e8a1ba50c46b | 1 | #!/bin/sh |
pmallick | 0:e8a1ba50c46b | 2 | # |
pmallick | 0:e8a1ba50c46b | 3 | # An example hook script to prepare the commit log message. |
pmallick | 0:e8a1ba50c46b | 4 | # Called by "git commit" with the name of the file that has the |
pmallick | 0:e8a1ba50c46b | 5 | # commit message, followed by the description of the commit |
pmallick | 0:e8a1ba50c46b | 6 | # message's source. The hook's purpose is to edit the commit |
pmallick | 0:e8a1ba50c46b | 7 | # message file. If the hook fails with a non-zero status, |
pmallick | 0:e8a1ba50c46b | 8 | # the commit is aborted. |
pmallick | 0:e8a1ba50c46b | 9 | # |
pmallick | 0:e8a1ba50c46b | 10 | # To enable this hook, rename this file to "prepare-commit-msg". |
pmallick | 0:e8a1ba50c46b | 11 | |
pmallick | 0:e8a1ba50c46b | 12 | # This hook includes three examples. The first one removes the |
pmallick | 0:e8a1ba50c46b | 13 | # "# Please enter the commit message..." help message. |
pmallick | 0:e8a1ba50c46b | 14 | # |
pmallick | 0:e8a1ba50c46b | 15 | # The second includes the output of "git diff --name-status -r" |
pmallick | 0:e8a1ba50c46b | 16 | # into the message, just before the "git status" output. It is |
pmallick | 0:e8a1ba50c46b | 17 | # commented because it doesn't cope with --amend or with squashed |
pmallick | 0:e8a1ba50c46b | 18 | # commits. |
pmallick | 0:e8a1ba50c46b | 19 | # |
pmallick | 0:e8a1ba50c46b | 20 | # The third example adds a Signed-off-by line to the message, that can |
pmallick | 0:e8a1ba50c46b | 21 | # still be edited. This is rarely a good idea. |
pmallick | 0:e8a1ba50c46b | 22 | |
pmallick | 0:e8a1ba50c46b | 23 | COMMIT_MSG_FILE=$1 |
pmallick | 0:e8a1ba50c46b | 24 | COMMIT_SOURCE=$2 |
pmallick | 0:e8a1ba50c46b | 25 | SHA1=$3 |
pmallick | 0:e8a1ba50c46b | 26 | |
pmallick | 0:e8a1ba50c46b | 27 | /usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" |
pmallick | 0:e8a1ba50c46b | 28 | |
pmallick | 0:e8a1ba50c46b | 29 | # case "$COMMIT_SOURCE,$SHA1" in |
pmallick | 0:e8a1ba50c46b | 30 | # ,|template,) |
pmallick | 0:e8a1ba50c46b | 31 | # /usr/bin/perl -i.bak -pe ' |
pmallick | 0:e8a1ba50c46b | 32 | # print "\n" . `git diff --cached --name-status -r` |
pmallick | 0:e8a1ba50c46b | 33 | # if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; |
pmallick | 0:e8a1ba50c46b | 34 | # *) ;; |
pmallick | 0:e8a1ba50c46b | 35 | # esac |
pmallick | 0:e8a1ba50c46b | 36 | |
pmallick | 0:e8a1ba50c46b | 37 | # SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
pmallick | 0:e8a1ba50c46b | 38 | # git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" |
pmallick | 0:e8a1ba50c46b | 39 | # if test -z "$COMMIT_SOURCE" |
pmallick | 0:e8a1ba50c46b | 40 | # then |
pmallick | 0:e8a1ba50c46b | 41 | # /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" |
pmallick | 0:e8a1ba50c46b | 42 | # fi |