From: Marcel Koeppen Date: Wed, 21 May 2008 16:25:54 +0000 (+0200) Subject: Fix prepare-commit-msg hook and replace in-place sed X-Git-Tag: v1.5.6-rc0~41 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4be1fe1b944e568f47efcb9d1beb8639f50b723f;p=git.git Fix prepare-commit-msg hook and replace in-place sed The patterns to the case statement could never be matched, so the hook was a noop. This patch also replaces the non-portable use of in-place sed. Signed-off-by: Marcel Koeppen Signed-off-by: Junio C Hamano --- diff --git a/templates/hooks--prepare-commit-msg b/templates/hooks--prepare-commit-msg index ff0f42a1d..d3c1da34d 100644 --- a/templates/hooks--prepare-commit-msg +++ b/templates/hooks--prepare-commit-msg @@ -20,11 +20,11 @@ # 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) - sed -i '/^Conflicts:/,/#/!b;s/^/# &/;s/^# #/#/' "$1" ;; +case "$2,$3" in + merge,) + perl -i -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; -# ""|template) +# ,|template,) # perl -i -pe ' # print "\n" . `git diff --cached --name-status -r` # if /^#/ && $first++ == 0' "$1" ;;