git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] format-patch: use raw format for notes
@ 2025-03-18 18:02 Tuomas Ahola
  2025-03-18 21:14 ` brian m. carlson
  2025-03-18 21:17 ` Junio C Hamano
  0 siblings, 2 replies; 11+ messages in thread
From: Tuomas Ahola @ 2025-03-18 18:02 UTC (permalink / raw)
  To: git; +Cc: Tuomas Ahola

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.

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);
 		format_display_notes(&commit->object.oid, &notebuf,
 				     get_log_output_encoding(), raw);
 		ctx.notes_message = strbuf_detach(&notebuf, NULL);

base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH] format-patch: use raw format for notes
@ 2017-08-28  4:23 Sam Bobroff
  2017-09-06  3:34 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Sam Bobroff @ 2017-08-28  4:23 UTC (permalink / raw)
  To: git

If "--notes=..." is used with "git format-patch", the notes are
prefixed with the ref's local name and indented, which looks odd and
exposes the path of the ref.

Extend the test that suppresses this behaviour so that it also catches
this case, causing the notes to be included without additional
processing.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
---

Notes (foo):
    Hi,
    
    I've noticed what appears to be a small cosmetic bug in git format-patch, as
    I've described in the commit message.
    
    I'm not sure if this patch is the right way to fix it (or perhaps it's not even
    a bug), but it should at least help to explain what I'm talking about.
    
    I've used "git format-patch --notes=foo" to prepare this email so that it is an
    example of the issue :-)
    
    Cheers,
    Sam.

 log-tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/log-tree.c b/log-tree.c
index 410ab4f02..26bc21ad3 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -655,7 +655,8 @@ 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);
 		format_display_notes(&commit->object.oid, &notebuf,
 				     get_log_output_encoding(), raw);
 		ctx.notes_message = notebuf.len
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-03-19  0:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).