From: Junio C Hamano <gitster@pobox.com>
To: Jeremiah Mahler <jmmahler@gmail.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH v7 1/2] format-patch: make newline after signature conditional
Date: Wed, 21 May 2014 14:22:38 -0700 [thread overview]
Message-ID: <xmqq1tvmq129.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1400706472-13471-2-git-send-email-jmmahler@gmail.com> (Jeremiah Mahler's message of "Wed, 21 May 2014 14:07:51 -0700")
Jeremiah Mahler <jmmahler@gmail.com> writes:
> From: Jeff King <peff@peff.net>
>
> When we print an email signature, we print the divider "--
> \n", then the signature string, then two newlines.
> Traditionally the signature is a one-liner (and the default
> is just the git version), so the extra newline makes sense.
>
> But one could easily specify a longer, multi-line signature,
> like:
>
> git format-patch --signature='
> this is my long signature
>
> it has multiple lines
> ' ...
>
> We should notice that it already has its own trailing
> newline, and suppress one of ours.
That is a half-good example; the first line being a blank is
misleading, as we are not doing anything about that, though.
Other than that, the patch looks OK to me. If anybody complains we
can fix it later to do more cleansing.
> Signed-off-by: Jeff King <peff@peff.net>
> Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
> ---
> builtin/log.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index 39e8836..5acc048 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -844,8 +844,13 @@ static void gen_message_id(struct rev_info *info, char *base)
>
> static void print_signature(void)
> {
> - if (signature && *signature)
> - printf("-- \n%s\n\n", signature);
> + if (!signature || !*signature)
> + return;
> +
> + printf("-- \n%s", signature);
> + if (signature[strlen(signature)-1] != '\n')
> + putchar('\n');
> + putchar('\n');
> }
>
> static void add_branch_description(struct strbuf *buf, const char *branch_name)
next prev parent reply other threads:[~2014-05-21 21:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 21:07 [PATCH v7 0/2] format-patch --signature-file <file> Jeremiah Mahler
2014-05-21 21:07 ` [PATCH v7 1/2] format-patch: make newline after signature conditional Jeremiah Mahler
2014-05-21 21:22 ` Junio C Hamano [this message]
2014-05-21 21:07 ` [PATCH v7 2/2] format-patch --signature-file <file> Jeremiah Mahler
2014-05-21 21:59 ` 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=xmqq1tvmq129.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jmmahler@gmail.com \
--cc=peff@peff.net \
/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.