diff options
Diffstat (limited to 'templates')
-rwxr-xr-x | templates/hooks--pre-rebase.sample | 6 | ||||
-rwxr-xr-x | templates/hooks--prepare-commit-msg.sample | 30 |
2 files changed, 21 insertions, 15 deletions
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks--pre-rebase.sample index 053f1111c0..b7f81c198e 100755 --- a/templates/hooks--pre-rebase.sample +++ b/templates/hooks--pre-rebase.sample @@ -88,9 +88,7 @@ else exit 1 fi -exit 0 - -################################################################ +<<\DOC_END This sample hook safeguards topic branches that have been published from being rewound. @@ -167,3 +165,5 @@ To compute (2): git rev-list master..topic if this is empty, it is fully merged to "master". + +DOC_END diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks--prepare-commit-msg.sample index 86b8f227ec..dc707e46eb 100755 --- a/templates/hooks--prepare-commit-msg.sample +++ b/templates/hooks--prepare-commit-msg.sample @@ -9,8 +9,8 @@ # # To enable this hook, rename this file to "prepare-commit-msg". -# This hook includes three examples. The first comments out the -# "Conflicts:" part of a merge commit. +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. # # The second includes the output of "git diff --name-status -r" # into the message, just before the "git status" output. It is @@ -20,17 +20,23 @@ # The third example adds a Signed-off-by line to the message, that can # still be edited. This is rarely a good idea. -case "$2,$3" in - merge,) - @PERL_PATH@ -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 -# ,|template,) -# @PERL_PATH@ -i.bak -pe ' -# print "\n" . `git diff --cached --name-status -r` -# if /^#/ && $first++ == 0' "$1" ;; +@PERL_PATH@ -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" - *) ;; -esac +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# @PERL_PATH@ -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# @PERL_PATH@ -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi |