]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/am.c
am: match --signoff to the original scripted version
authorJunio C Hamano <gitster@pobox.com>
Sun, 6 Sep 2015 02:56:20 +0000 (19:56 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Sep 2015 02:59:40 +0000 (19:59 -0700)
commitaab845424ef4b9a3fd29406e3d722324440e4a00
tree4f6f3b3f28ac87f40eb8953081b02a508a6a8ad6
parentb5e823594cff190bc18361207a89b08d57b038d7
am: match --signoff to the original scripted version

Linus noticed that the recently reimplemented "git am -s" defines
the trailer block too rigidly, resulting in an unnecessary blank
line between the existing sign-offs and his new sign-off.  An e-mail
submission sent to Linus in real life ends with mixture of sign-offs
and commentaries, e.g.

title here

message here

Signed-off-by: Original Author <original@auth.or>
[rv: tweaked frotz and nitfol]
Signed-off-by: Re Viewer <rv@ew.er>
Signed-off-by: Other Reviewer <other@rev.ewer>
---
patch here

Because the reimplementation reused append_signoff() helper that is
used by other codepaths, which is unaware that people intermix such
comments with their sign-offs in the trailer block, such a message
was judged to end with a non-trailer, resulting in an extra blank
line before adding a new sign-off.

The original scripted version of "git am" used a lot looser
definition, i.e. "if and only if there is no line that begins with
Signed-off-by:, add a blank line before adding a new sign-off".  For
the upcoming release, stop using the append_signoff() in "git am"
and reimplement the looser definition used by the scripted version
to use only in "git am" to fix this regression in "am" while
avoiding new regressions to other users of append_signoff().

In the longer term, we should look into loosening append_signoff()
so that other codepaths that add a new sign-off behave the same way
as "git am -s", but that is a task for post-release.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/am.c
t/t4150-am.sh