From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johannes Sixt <j6t@kdbg.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Paul Tan <pyokagan@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: More builtin git-am issues..
Date: Sat, 05 Sep 2015 09:10:39 -0700 [thread overview]
Message-ID: <xmqqk2s4deyo.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20150905080325.GA25039@sigill.intra.peff.net> (Jeff King's message of "Sat, 5 Sep 2015 04:03:26 -0400")
Jeff King <peff@peff.net> writes:
> [1] I think part of the reason people are interested in "fancy" here is
> that this topic extends beyond "git am". There's "commit -s", of
> course, but there's also the generic "interpret-trailers" command,
> which is supposed to be a generalization of the "--signoff" option.
> It would be nice if the rules remained consistent for when we add a
> trailer to an existing block, rather than special-casing signoffs.
>
> But again, I think that's something to shoot for in the long run.
> It's more important in the short term not to regress "am".
Yes. I personally think the global append_signoff() everybody else
uses can and should implement the same logic (whichever the exact
logic is) as whatever is used by "am" because the caller that makes
a call to that function knows it is adding a "Signed-off-by:" line,
so existing "Signed-off-by" lines are already special in that context.
But for the purpose of 2.6-rc period, I think we should start from
doing a separate implementation inside builtin/am.c without touching
append_signoff().
We can do a more thoughtful refactoring for append_signoff() in the
next cycle. Another thing that needs consideration is the other
user of the has_conforming_footer() helper append_signoff() uses,
which is the codepath to add "cherry-picked-from"; it is less
obvious that "find Signed-off-by: anywhere in the text to decide if
the new footer needs its own paragraph" is a good logic in that
context.
To salvage "interpret-trailers" needs a lot more, as we are
realizing that the definition that led to its external design does
not match the way users use footers in the real world. This affects
the internal data representation and the whole thing needs to be
rethought.
Here is a quick attempt to do the "just fix am regression without
changing anything else".
builtin/am.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/builtin/am.c b/builtin/am.c
index 83b3d86..c63d238 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1213,9 +1213,24 @@ static void NORETURN die_user_resolve(const struct am_state *state)
static void am_append_signoff(struct am_state *state)
{
struct strbuf sb = STRBUF_INIT;
+ char *cp;
strbuf_attach(&sb, state->msg, state->msg_len, state->msg_len);
- append_signoff(&sb, 0, 0);
+ strbuf_complete_line(&sb);
+
+ for (cp = sb.buf;
+ cp && *cp && (cp = strstr(cp, sign_off_header)) != NULL;
+ cp = strchr(cp, '\n')) {
+ if (sb.buf < cp && cp[-1] == '\n')
+ break;
+ }
+ if (!cp)
+ strbuf_addch(&sb, '\n');
+ strbuf_addf(&sb, "%s%s\n",
+ sign_off_header,
+ fmt_name(getenv("GIT_COMMITTER_NAME"),
+ getenv("GIT_COMMITTER_EMAIL")));
+ strbuf_addch(&sb, '\n');
state->msg = strbuf_detach(&sb, &state->msg_len);
}
next prev parent reply other threads:[~2015-09-05 16:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-04 23:47 More builtin git-am issues Linus Torvalds
2015-09-04 23:52 ` Linus Torvalds
2015-09-05 0:07 ` Jeff King
2015-09-05 0:36 ` Linus Torvalds
2015-09-05 0:54 ` Junio C Hamano
2015-09-05 1:06 ` Linus Torvalds
2015-09-05 1:23 ` Junio C Hamano
2015-09-05 1:35 ` Linus Torvalds
2015-09-05 16:01 ` Junio C Hamano
2015-09-05 7:30 ` Johannes Sixt
2015-09-05 8:03 ` Jeff King
2015-09-05 16:10 ` Junio C Hamano [this message]
2015-09-05 16:32 ` Junio C Hamano
2015-09-05 16:57 ` Junio C Hamano
2015-09-05 19:39 ` Junio C Hamano
2015-09-07 19:27 ` Christian Couder
2015-09-05 15:24 ` Junio C Hamano
2015-09-05 15:34 ` Junio C Hamano
2015-09-05 1:06 ` Junio C Hamano
2015-09-05 1:20 ` Linus Torvalds
2015-09-05 1:24 ` Junio C Hamano
2015-09-06 4:56 ` [PATCH] am: match --signoff to the original scripted version Junio C Hamano
2015-09-06 9:04 ` Paul Tan
2015-09-06 17:24 ` Junio C Hamano
2015-09-08 6:18 ` Jeff King
2015-09-06 14:21 ` Paul Tan
2015-09-06 17:39 ` Junio C Hamano
2015-09-06 16:16 ` Linus Torvalds
2015-09-08 6:25 ` Jeff King
2015-09-08 18:14 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqk2s4deyo.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=peff@peff.net \
--cc=pyokagan@gmail.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.