From: Jeff King <peff@peff.net>
To: Luca Weiss <luca@z3ntu.xyz>
Cc: git@vger.kernel.org
Subject: Re: git interpret-trailers: behavior with input without trailing newline
Date: Mon, 12 Jul 2021 20:35:25 -0400 [thread overview]
Message-ID: <YOzfzQsuDOeL8VY9@coredump.intra.peff.net> (raw)
In-Reply-To: <CCNOOVFJVMLC.7L79PCH59K1C@arch-vps>
On Thu, Jul 08, 2021 at 10:33:46AM +0000, Luca Weiss wrote:
> I'm investigating a behavior with git interpret-trailers where when
> the input does not end with a newline, git appends the trailer
> directly without a newline; and on running the same command again it
> doesn't detect the previous trailer anymore.
>
> I've whipped up a quick PoC in form of a new test case in the existing
> test cases of git.
In general, I think commit message inputs should have trailing newlines,
as they'd generally be coming from actual commits, or piped through
git-stripspace to clean things up.
That said, the behavior you're seeing does seem like a bug to me. I
don't think it was intended, and it would be nice to fix it, if you're
up for it. It might be as simple as conditionally adding a newline after
we read the input in trailers.c:read_input_file(). (IMHO even if we do
not end up adding a trailer, normalizing the whitespace in this way
would be a fine behavior for the command).
-Peff
prev parent reply other threads:[~2021-07-13 0:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-08 10:33 git interpret-trailers: behavior with input without trailing newline Luca Weiss
2021-07-13 0:35 ` Jeff King [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YOzfzQsuDOeL8VY9@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=luca@z3ntu.xyz \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).