All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Koeppen <git-dev@marzelpan.de>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH] Fix prepare-commit-msg hook and replace in-place sed
Date: Wed, 21 May 2008 18:25:54 +0200	[thread overview]
Message-ID: <1211387154-8792-1-git-send-email-git-dev@marzelpan.de> (raw)

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>
---
 templates/hooks--prepare-commit-msg |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/templates/hooks--prepare-commit-msg b/templates/hooks--prepare-commit-msg
index ff0f42a..d3c1da3 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" ;;
-- 
1.5.5.1.316.g377d9

                 reply	other threads:[~2008-05-21 16:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1211387154-8792-1-git-send-email-git-dev@marzelpan.de \
    --to=git-dev@marzelpan.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.