Re: [PATCH] Handle "git show" output correctly.
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Sep 12, 2012, 15:40 UTC
- Message-ID
- <vpqpq5rz1ua.fsf@bauges.imag.fr>
- In-Reply-To
- <1347463571-16831-1-git-send-email-pjones@redhat.com>
> 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 <pjones@redhat.com> 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?
Show 21 quoted lines
> --- 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.
Show 9 quoted lines
> 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 anWrong cut-and-paste again, the sentense doesn't parse.
Show 17 quoted lines
> + # 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/