@matheusbsbs / matheus-bagliano / commits / 4be1fe1b94
Fork 0

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 <git-dev@marzelpan.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Marcel Koeppen committed May 21, 2008 at 18:25 UTC 4be1fe1b944e568f47efcb9d1beb8639f50b723f
1 file changed +4 -4
templates/hooks--prepare-commit-msg
+4 -4
@@ -20,11 +20,11 @@
20 # The third example adds a Signed-off-by line to the message, that can
21 # still be edited. This is rarely a good idea.
22
23 -case "$2 $3" in
24 - merge)
25 - sed -i '/^Conflicts:/,/#/!b;s/^/# &/;s/^# #/#/' "$1" ;;
23 +case "$2,$3" in
24 + merge,)
25 + perl -i -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
26
27 -# ""|template)
27 +# ,|template,)
28 # perl -i -pe '
29 # print "\n" . `git diff --cached --name-status -r`
30 # if /^#/ && $first++ == 0' "$1" ;;