git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] log-tree: let format-patch not indent notes
@ 2014-09-25 16:10 Uwe Kleine-König
  2014-09-25 17:24 ` Junio C Hamano
  2014-09-25 17:56 ` Jeff King
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2014-09-25 16:10 UTC (permalink / raw)
  To: git; +Cc: kernel

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 <u.kleine-koenig@pengutronix.de>
---
This commit changes the output of format-patch (applied on this commit) from:

	...
	case.

	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
	---

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

to

	...
	case.

	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
	---
	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

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

* Re: [PATCH RFC] log-tree: let format-patch not indent notes
  2014-09-25 16:10 [PATCH RFC] log-tree: let format-patch not indent notes Uwe Kleine-König
@ 2014-09-25 17:24 ` Junio C Hamano
  2014-09-25 18:08   ` Uwe Kleine-König
  2014-09-25 17:56 ` Jeff King
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2014-09-25 17:24 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: git, kernel

Uwe Kleine-König  <u.kleine-koenig@pengutronix.de> writes:

> 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 <u.kleine-koenig@pengutronix.de>
> ---
> This commit changes the output of format-patch (applied on this commit) from:
>
> 	...
> 	case.
>
> 	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 	---
>
> 	Notes:
> 	    This commit changes the output of format-patch (applied on this commit) from:
>
> to
>
> 	...
> 	case.
>
> 	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 	---
> 	This commit changes the output of format-patch (applied on this commit) from:
>
> which I consider to be more useful.

I suspect that is fairly subjective, as the current one is in that
form because those who wrote this feature first, reviewed, applied
would have considered it more useful, isn't it?

Because I never send out a format-patch output without looking it
over in an editor, I know I can easily remove it if I find the
"Notes:" out of place in the output, but if the "Notes:" thing
weren't there in the first place I may scratch my head trying to
figure out where to update it if the information there were stale,
so for that reason I'd find it more useful to have Notes: to remind
me where that information comes from.

But that is just my personal preference and I am willing to be
persuaded either way with a better argument than "to me it looks
nicer".

As to indenting, because the material after three-dashes is meant to
be fed to "git apply" or "patch", I'd prefer to keep it to avoid
having to worry about a payload that may look like part of a patch.
This preference is a bit stronger than the presence/absence of
"Notes:".

Thanks.

>  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

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

* Re: [PATCH RFC] log-tree: let format-patch not indent notes
  2014-09-25 16:10 [PATCH RFC] log-tree: let format-patch not indent notes Uwe Kleine-König
  2014-09-25 17:24 ` Junio C Hamano
@ 2014-09-25 17:56 ` Jeff King
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff King @ 2014-09-25 17:56 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: git, kernel

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 <u.kleine-koenig@pengutronix.de>
> ---

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

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

* Re: [PATCH RFC] log-tree: let format-patch not indent notes
  2014-09-25 17:24 ` Junio C Hamano
@ 2014-09-25 18:08   ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2014-09-25 18:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, kernel

Hello Junio,

On Thu, Sep 25, 2014 at 10:24:53AM -0700, Junio C Hamano wrote:
> Uwe Kleine-König  <u.kleine-koenig@pengutronix.de> writes:
> > 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 <u.kleine-koenig@pengutronix.de>
> > ---
> > This commit changes the output of format-patch (applied on this commit) from:
> >
> > 	...
> > 	case.
> >
> > 	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 	---
> >
> > 	Notes:
> > 	    This commit changes the output of format-patch (applied on this commit) from:
> >
> > to
> >
> > 	...
> > 	case.
> >
> > 	Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 	---
> > 	This commit changes the output of format-patch (applied on this commit) from:
> >
> > which I consider to be more useful.
> 
> I suspect that is fairly subjective, as the current one is in that
> form because those who wrote this feature first, reviewed, applied
> would have considered it more useful, isn't it?
Well, I thought when the feature to dump the notes into a patch was
created there was exactly one way these notes were written. This was was
designed for git-log and so intended and with "Notes:". For
git-format-patch it was good enough.

> Because I never send out a format-patch output without looking it
> over in an editor, I know I can easily remove it if I find the
> "Notes:" out of place in the output, but if the "Notes:" thing
> weren't there in the first place I may scratch my head trying to
> figure out where to update it if the information there were stale,
> so for that reason I'd find it more useful to have Notes: to remind
> me where that information comes from.
As you must explicitly request notes to be included in patches (--notes)
I think it's unusual to not know where the info comes from, doesn't it?

I don't know how many people use git-notes to track their comments, but
the first thing I do when editing patches is to remove the Notes: header
and s/^    // on the remaining lines. And most of the time this is the
only thing I do and I need to touch every patch only because of
that.

> But that is just my personal preference and I am willing to be
> persuaded either way with a better argument than "to me it looks
> nicer".
> 
> As to indenting, because the material after three-dashes is meant to
> be fed to "git apply" or "patch", I'd prefer to keep it to avoid
> having to worry about a payload that may look like part of a patch.
> This preference is a bit stronger than the presence/absence of
> "Notes:".
Ok, that's a valid concern. If we want to assert that this doesn't look
like a patch we need to at least parse the notes and quote it somehow.
Hmm.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2014-09-25 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 16:10 [PATCH RFC] log-tree: let format-patch not indent notes Uwe Kleine-König
2014-09-25 17:24 ` Junio C Hamano
2014-09-25 18:08   ` Uwe Kleine-König
2014-09-25 17:56 ` 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).