[PATCH RFC] log-tree: let format-patch not indent notes

Subsystems: the rest

DORMANTno replies

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH RFC] log-tree: let format-patch not indent notes

From: Uwe Kleine-König <hidden>
Date: 2016-06-15 23:02:35

Commit logs as shown by git-log are usually indented by four spaces so
here it makes sense to do the same for commit notes.

However when using format-patch to create a patch for submission via
e-mail the commit log isn't indented and also the "Notes:" header isn't
really useful. So consequently don't indent and skip the header in this
case. This also removes the empty line between the end-of-commit marker
and the start of the notes.

Signed-off-by: Uwe Kleine-König <redacted>
---
This commit changes the output of format-patch (applied on this commit) from:

	...
	case.

	Signed-off-by: Uwe Kleine-König [off-list ref]
	---

	Notes:
	    This commit changes the output of format-patch (applied on this commit) from:

to

	...
	case.

	Signed-off-by: Uwe Kleine-König [off-list ref]
	---
	This commit changes the output of format-patch (applied on this commit) from:

which I consider to be more useful.

 log-tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/log-tree.c b/log-tree.c
index bcee7c596696..c1d73d8fecdf 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -585,7 +585,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.sha1, &notebuf,
 				     get_log_output_encoding(), raw);
 		ctx.notes_message = notebuf.len
-- 
2.1.1.274.gb3e1830.dirty

Re: [PATCH RFC] log-tree: let format-patch not indent notes

From: Jeff King <hidden>
Date: 2016-06-15 23:02:35

On Thu, Sep 25, 2014 at 06:10:09PM +0200, Uwe Kleine-König wrote:
Commit logs as shown by git-log are usually indented by four spaces so
here it makes sense to do the same for commit notes.

However when using format-patch to create a patch for submission via
e-mail the commit log isn't indented and also the "Notes:" header isn't
really useful. So consequently don't indent and skip the header in this
case. This also removes the empty line between the end-of-commit marker
and the start of the notes.

Signed-off-by: Uwe Kleine-König <redacted>
---
I like this, though I think it is somewhat subjective, and there may be
some corner cases. This topic has come up before (this is the tip of
what I dug up, but I did not bother reading back further myself):

  http://article.gmane.org/gmane.comp.version-control.git/163144

You'd also need to consider what happens with non-default notes. If you
do "--show-notes=foo" then your header is more like:

  Notes (foo):
     blah blah blah

and your patch loses the information on the source.  You may even be
pulling in from multiple sets of notes, in which case there are multiple
headers with multiple sources.

I wonder if we would need an option to say "I am showing notes, but from
just one ref and I prefer the simple three-dash format". Like
"--cover-notes[=<ref>]" or something. I dunno.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help