From: Junio C Hamano <gitster@pobox.com>
To: Tuomas Ahola <taahol@utu.fi>
Cc: <git@vger.kernel.org>
Subject: Re: [PATCH] format-patch: use raw format for notes
Date: Tue, 18 Mar 2025 14:17:32 -0700 [thread overview]
Message-ID: <xmqqy0x2yr6b.fsf@gitster.g> (raw)
In-Reply-To: <20250318180251.3712-1-taahol@utu.fi> (Tuomas Ahola's message of "Tue, 18 Mar 2025 20:02:51 +0200")
Tuomas Ahola <taahol@utu.fi> writes:
> The default formatting of commit notes by git format-patch --notes
> doesn't make a very good fit. It would be more beneficial to use the
> raw format for CMIT_FMT_EMAIL and CMIT_FMT_MBOXRD.
Hmph. That is unfortunately quite subjective. "doesn't make a very
good fit" why? "more benefitial" why?
And it turns out that using "raw" is not a good choice in the
context of e-mailed patches. Read on.
> Signed-off-by: Tuomas Ahola <taahol@utu.fi>
> ---
> log-tree.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/log-tree.c b/log-tree.c
> index 8b184d6776..c40a7599d0 100644
> --- a/log-tree.c
> +++ b/log-tree.c
> @@ -857,7 +857,9 @@ void show_log(struct rev_info *opt)
> int raw;
> struct strbuf notebuf = STRBUF_INIT;
>
> - raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
> + raw = (opt->commit_format == CMIT_FMT_USERFORMAT ||
> + opt->commit_format == CMIT_FMT_EMAIL ||
> + opt->commit_format == CMIT_FMT_MBOXRD);
After applying this patch and running
$ git format-patch --notes=amlog -1
(where refs/notes/amlog holds commit to original e-mail mapping), I
get this:
...
Subject: [PATCH] format-patch: use raw format for notes
...
Signed-off-by: Tuomas Ahola <taahol@utu.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Notes (amlog):
Message-Id: <20250318180251.3712-1-taahol@utu.fi>
log-tree.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
...
But with this patch in place, I instead get this:
...
Subject: [PATCH] format-patch: use raw format for notes
...
Signed-off-by: Tuomas Ahola <taahol@utu.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Message-Id: <20250318180251.3712-1-taahol@utu.fi>
log-tree.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
...
There is no indication where the note came from, and more
importantly, the contents of the note loses its crucial leading
spaces that makes sure that any random lines in the note that happen
to begin with "diff", "---", etc. are not mistaken as the beginning
of the first patch.
So, no, this change is not a good thing to do, at least in its
current form. Besides, unconditional change like this will break
existing users.
next prev parent reply other threads:[~2025-03-18 21:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 18:02 [PATCH] format-patch: use raw format for notes Tuomas Ahola
2025-03-18 21:14 ` brian m. carlson
2025-03-18 21:17 ` Junio C Hamano [this message]
2025-03-18 21:30 ` Tuomas Ahola
2025-03-19 0:52 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2017-08-28 4:23 Sam Bobroff
2017-09-06 3:34 ` Junio C Hamano
2017-09-11 4:27 ` Sam Bobroff
2017-09-12 17:33 ` Stefan Beller
2017-09-13 0:38 ` Sam Bobroff
2017-09-13 13:03 ` Jeff King
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=xmqqy0x2yr6b.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=taahol@utu.fi \
/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 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 NNTP newsgroup(s).