Skip to contentSkip to conversation

Fix prepare-commit-msg hook and replace in-place sed

PATCH New Marcel Koeppen 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 templates/hooks--prepare-commit-msg |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
templates/hooks--prepare-commit-msg +4 -4
index ff0f42a..d3c1da3 100644
@@ -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" ;;
Signature · 1 line
1.5.5.1.316.g377d9