my customized lib

Committer:
DuyLionTran
Date:
Sun Nov 26 15:08:14 2017 +0000
Revision:
0:8094b249013c
Initial commit

Who changed what in which revision?

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