Re: [PATCH v1] am: fix signoff when other trailers are present
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Aug 7, 2017, 18:08 UTC
- Message-ID
- <20170807110817.3cf7d8ff@twelve2.svl.corp.google.com>
- In-Reply-To
- <xmqqfud3qndj.fsf@gitster.mtv.corp.google.com>
On Mon, 07 Aug 2017 10:49:28 -0700 Junio C Hamano <gitster@pobox.com> wrote:
Show 35 quoted lines
> Phillip Wood <phillip.wood@talktalk.net> writes:
>
> > From: Phillip Wood <phillip.wood@dunelm.org.uk>
> >
> > If there was no 'Signed-off-by:' trailer but another trailer such as
> > 'Reported-by:' then 'git am --signoff' would add a blank line between
> > the existing trailers and the added 'Signed-off-by:' line. e.g.
> >
> > Rebase accepts '--rerere-autoupdate' as an option but only honors
> > it if '-m' is also given. Fix it for a non-interactive rebase by
> > passing on the option to 'git am' and 'git cherry-pick'.
> >
> > Reported-by: Junio C Hamano <gitster@pobox.com>
> >
> > Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> >
> > Fix by using the code provided for this purpose in sequencer.c.
> > Change the tests so that they check the formatting of the
> > 'Signed-off-by:' lines rather than just grepping for them.
> >
> > Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> > ---
> > I'm not sure if this should be calling ignore_non_trailer() or not -
> > git commit does but git cherry-pick does not. This follows commit and
> > cherry-pick in ignoring the value of trailer.ifExists for the signoff.
> > I'm a bit surprised they do that - is it correct?
>
> These built-in "sign-off" machinery long predates the "trailer"
> thing, so I am not surprised if they do not behave the same. I
> vaguely recall having discussions on this earlier this year, but
> details escape me.
>
> Asking Jonathan, who did a series that ends at 44dc738a ("sequencer:
> add newline before adding footers", 2017-04-26), and Christian, who
> is the original contirbutor to the "trailer" machinery, for input.Regarding ignore_non_trailer(), I believe that's because "git commit" wants to tolerate blank lines and comments after the "real" commit message, whereas "git cherry-pick" doesn't need to. As far as I can tell, this "git am" case is similar to "git cherry-pick".
Regarding trailer.ifExists, the then existing behavior was to refrain from writing a new sign-off line only if it would be a duplicate of the last one, regardless of trailer.ifExists (as Junio says, back then, the sign-off mechanism and the trailer mechanism were independent). I preserved that behavior.