Subject: Re: [PATCH] Handle "git show" output correctly.
No final period please.
This does not say which part of git is made to handle "git show". What
about
[PATCH] am: handle "git show" output correctly
Peter Jones [off-list ref] writes:
This lacks a proper commit message, i.e. an answer to the "why is this
change good?" question.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
git-am.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
Documentation?
quoted hunk
--- a/git-am.sh
+++ b/git-am.sh
@@ -216,6 +216,21 @@ check_patch_format () {
read l2
read l3
case "$l1" in
+ "commit "*)
+ case "$l2" in
+ "Author: "*)
+ case "$l3" in
+ "Date: "*)
+ patch_format=gitshow
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
Your code is indented with space, Git indents with tabs. Please fix this
in your next version.
quoted hunk
patch_format=mbox
;;
@@ -321,6 +336,37 @@ split_patches () {
this=
msgnum=
;;
+ gitshow)
+ this=0
+ for stgit in "$@"
Probably a cut-and-paste from the stgit version, but your variable
naming doesn't make sense here.
+ do
+ this=`expr "$this" + 1`
+ msgnum=`printf "%0${prec}d" $this`
+ # Perl version of The first nonemptyline after an
Wrong cut-and-paste again, the sentense doesn't parse.
+ # empty line is the subject, and the body starts with
+ # the next nonempty line.
+ perl -ne 'BEGIN { $subject = 0 }
+ if ($subject > 1) { print ; }
+ elsif (/^\s+$/) { next ; }
+ elsif (/^Author:/) { s/Author/From/ ; print ;}
+ elsif (/^(From|Date)/) { print ; }
+ elsif (/^commit/) { next ; }
+ elsif ($subject) {
+ $subject = 2 ;
+ print "\n" ;
+ s/^ // ;
+ print ;
+ } else {
+ print "Subject: ", $_ ;
+ $subject = 1;
+ }
How does this react to multi-line subject, e.g
This should be the
subject line.
And this is the body.
?
git format-patch will merge the lines in a single Subject: header, and
your version seems to take only the first line.
A test showing this would be welcome.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/