Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] format-patch: fix skipping of blank-lines
Date: Fri, 08 Jul 2005 17:46:27 -0700	[thread overview]
Message-ID: <7vu0j44xi4.fsf@assigned-by-dhcp.cox.net> (raw)

If it is fed a commit with more than one leading blank lines,
the sed scripts git-format-patch-script used looped forever.
This patch fixes it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 git-format-patch-script |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

58a3c79b488a28897cd5556dab0dd599b4ed9f0c
diff --git a/git-format-patch-script b/git-format-patch-script
--- a/git-format-patch-script
+++ b/git-format-patch-script
@@ -66,9 +66,13 @@ trap 'rm -f $tmp-*' 0 1 2 3 15
 series=$tmp-series
 
 titleScript='
-	1,/^$/d
+	/./d
 	: loop
-	/^$/b loop
+	/^$/{
+		n
+		b loop
+	}
+	s/^\[PATCH[^]]*\] *//
 	s/[^-a-z.A-Z_0-9]/-/g
         s/\.\.\.*/\./g
 	s/\.*$//
@@ -76,6 +80,7 @@ titleScript='
 	s/^-//
 	s/-$//
 	s/$/./
+	p
 	q
 '
 
@@ -88,7 +93,7 @@ total=`wc -l <$series`
 i=$total
 while read commit
 do
-    title=`git-cat-file commit "$commit" | sed -e "$titleScript"`
+    title=`git-cat-file commit "$commit" | sed -ne "$titleScript"`
     case "$numbered" in
     '') num= ;;
     *)
@@ -102,9 +107,12 @@ do
     echo "$file"
     {
 	mailScript='
-	1,/^$/d
+	/./d
 	: loop
-	/^$/b loop
+	/^$/{
+		n
+		b loop
+	}
 	s|^|[PATCH'"$num"'] |
 	: body
 	p

             reply	other threads:[~2005-07-09  1:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-09  0:46 Junio C Hamano [this message]
2005-07-09  1:42 ` [PATCH] format-patch: fix skipping of blank-lines Linus Torvalds
2005-07-09  2:27   ` [PATCH] format-patch: fix skipping of blank-lines (take 2) Junio C Hamano

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=7vu0j44xi4.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox