aboutsummaryrefslogtreecommitdiff
path: root/git-format-patch-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-07-08 19:27:15 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-08 19:48:44 -0700
commit1855c044629a02488baa1bd25ae45341da33bd4e (patch)
treeae17bae47dfcd4c19c91c22856f6337c5fb8886a /git-format-patch-script
parented616049d76a59df10a9064f8883009ab1329da4 (diff)
downloadgit-1855c044629a02488baa1bd25ae45341da33bd4e.tar.gz
git-1855c044629a02488baa1bd25ae45341da33bd4e.tar.xz
[PATCH] format-patch: fix skipping of blank-lines
If it is fed a commit with more than one leading blank lines, the sed scripts git-format-patch-script used looped forever. Using git-stripspace upfront makes the sed script somewhat simpler to work around this problem. Also use git-rev-parse so that we can say $ git-format-patch-script HEAD^^^^ to prepare the latest four patches for e-mail submission. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'git-format-patch-script')
-rwxr-xr-xgit-format-patch-script22
1 files changed, 14 insertions, 8 deletions
diff --git a/git-format-patch-script b/git-format-patch-script
index a07e30e8d..9d26c9c46 100755
--- a/git-format-patch-script
+++ b/git-format-patch-script
@@ -53,6 +53,8 @@ case "$#" in
1) linus="$1" junio=HEAD ;;
*) usage ;;
esac
+junio=`git-rev-parse --verify "$junio"`
+linus=`git-rev-parse --verify "$linus"`
case "$outdir" in
*/) ;;
@@ -66,9 +68,9 @@ trap 'rm -f $tmp-*' 0 1 2 3 15
series=$tmp-series
titleScript='
- 1,/^$/d
- : loop
- /^$/b loop
+ /./d
+ /^$/n
+ s/^\[PATCH[^]]*\] *//
s/[^-a-z.A-Z_0-9]/-/g
s/\.\.\.*/\./g
s/\.*$//
@@ -76,6 +78,7 @@ titleScript='
s/^-//
s/-$//
s/$/./
+ p
q
'
@@ -88,7 +91,9 @@ 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" |
+ git-stripspace |
+ sed -ne "$titleScript"`
case "$numbered" in
'') num= ;;
*)
@@ -102,16 +107,17 @@ do
echo "$file"
{
mailScript='
- 1,/^$/d
- : loop
- /^$/b loop
+ /./d
+ /^$/n
s|^|[PATCH'"$num"'] |
: body
p
n
b body'
- git-cat-file commit "$commit" | sed -ne "$mailScript"
+ git-cat-file commit "$commit" |
+ git-stripspace |
+ sed -ne "$mailScript"
echo '---'
echo
git-diff-tree -p $diff_opts "$commit" | git-apply --stat --summary