All of lore.kernel.org
 help / color / mirror / Atom feed
* Add option in git-am to ignore leading text?
@ 2009-07-28  3:13 Frans Pop
  2009-07-28 14:22 ` Nicolas Sebrecht
  0 siblings, 1 reply; 7+ messages in thread
From: Frans Pop @ 2009-07-28  3:13 UTC (permalink / raw)
  To: git

The git-am manpage currently says:
  The body of the message (iow, after a blank line that terminates RFC2822
  headers) can begin with "Subject:" and "From:" lines that are different
  from those of the mail header, to override the values of these fields.

That's a very useful feature. However, on lkml there are frequently also 
mails with the following structure (example: [1]).

<example>
[Regular mail headers, including From: and Subject:]

[Comments, quotes from previous messages, or some introduction]

From: [email address]
Subject: [patch short description]
[patch long description]

[patch diff]
</example>

Here the overruling pseudo-headers are not at the beginning of the 
message, which results in all the leading comments getting included in 
the commit log and those have to be cleaned manually.

Would it be possible to add an option to git-am to "reset" the commit log 
when it encounters either a From: or Subject: pseudo header, so that only 
the intended patch short and long descriptions are used for the commit 
log?

Or is this already possible somehow?

Cheers,
FJP

[1] http://lkml.org/lkml/2009/7/10/49

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

* Re: Add option in git-am to ignore leading text?
  2009-07-28  3:13 Add option in git-am to ignore leading text? Frans Pop
@ 2009-07-28 14:22 ` Nicolas Sebrecht
  2009-07-28 14:31   ` Mark Brown
  2009-07-28 17:38   ` Frans Pop
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Sebrecht @ 2009-07-28 14:22 UTC (permalink / raw)
  To: Frans Pop; +Cc: git

The 28/07/09, Frans Pop wrote:
> 
> That's a very useful feature. However, on lkml there are frequently also 
> mails with the following structure (example: [1]).
> 
> [1] http://lkml.org/lkml/2009/7/10/49

This is an example of what not to do. Content after the '---' won't be
part of the commit message.

  $ man git-am
  <snip>
	The commit message is formed by the title taken from the "Subject: ",
  a blank line and the body of the message up to where the patch begins.
  Excess whitespace at the end of each line is automatically stripped.

  The patch is expected to be inline, directly following the
  message. Any line that is of the form:
   ·   three-dashes and end-of-line, or
   ·   a line that begins with "diff -", or
   ·   a line that begins with "Index: "
  is taken as the beginning of a patch, and the commit log message
  is terminated before the first occurrence of such a line.
  <snip>

> <example>
> [Regular mail headers, including From: and Subject:]
> 
> [Comments, quotes from previous messages, or some introduction]
> 
> From: [email address]
> Subject: [patch short description]
> [patch long description]
> 
> [patch diff]
> </example>
> 
> Here the overruling pseudo-headers are not at the beginning of the 
> message, which results in all the leading comments getting included in 
> the commit log and those have to be cleaned manually.
> 
> Would it be possible to add an option to git-am to "reset" the commit log 
> when it encounters either a From: or Subject: pseudo header, so that only 
> the intended patch short and long descriptions are used for the commit 
> log?

IMHO, a better way would be to ignore lines beginning with a defined
level of quotes in the commit message (the "level" beeing the number of
'>' or '> ' found at the beginning of a line. Something like

	--strip-quotes[=N]

where N is the level of quoted lines to remove (if "=N" is
not given, assume that the level is 1 and remove all the quotes).

Comments?

-- 
Nicolas Sebrecht

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

* Re: Add option in git-am to ignore leading text?
  2009-07-28 14:22 ` Nicolas Sebrecht
@ 2009-07-28 14:31   ` Mark Brown
  2009-07-28 17:38   ` Frans Pop
  1 sibling, 0 replies; 7+ messages in thread
From: Mark Brown @ 2009-07-28 14:31 UTC (permalink / raw)
  To: Nicolas Sebrecht; +Cc: Frans Pop, git

On Tue, Jul 28, 2009 at 04:22:19PM +0200, Nicolas Sebrecht wrote:

> IMHO, a better way would be to ignore lines beginning with a defined
> level of quotes in the commit message (the "level" beeing the number of
> '>' or '> ' found at the beginning of a line. Something like

> 	--strip-quotes[=N]

> where N is the level of quoted lines to remove (if "=N" is
> not given, assume that the level is 1 and remove all the quotes).

> Comments?

That would help but it'll still carry over at least part of the
discussion that preceeds the patch (normally the person sending the
patch will say something as well as including the patch) and it won't
pick up things like the subject line without some manual fixing.

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

* Re: Add option in git-am to ignore leading text?
  2009-07-28 14:22 ` Nicolas Sebrecht
  2009-07-28 14:31   ` Mark Brown
@ 2009-07-28 17:38   ` Frans Pop
  2009-07-28 18:15     ` Nicolas Sebrecht
  1 sibling, 1 reply; 7+ messages in thread
From: Frans Pop @ 2009-07-28 17:38 UTC (permalink / raw)
  To: Nicolas Sebrecht; +Cc: git

On Tuesday 28 July 2009, Nicolas Sebrecht wrote:
> The 28/07/09, Frans Pop wrote:
> > That's a very useful feature. However, on lkml there are frequently
> > also mails with the following structure (example: [1]).
> >
> > [1] http://lkml.org/lkml/2009/7/10/49
>
> This is an example of what not to do. Content after the '---' won't be
> part of the commit message.

Yes, I'm aware of that (and I omitted such a line from my example for that 
reason). But currently that's not really relevant as either with or 
without that line one needs to manually fix up things before the desired 
result is obtained.

If my feature request is implemented I'll of course make sure to omit the
'---' line if needed.

Here are some other examples (some of which would equally need to drop or 
change a separator line).
http://lkml.org/lkml/2009/6/25/62
http://lkml.org/lkml/2009/6/22/114
http://lkml.org/lkml/2009/6/30/109
http://lkml.org/lkml/2009/6/30/224

> IMHO, a better way would be to ignore lines beginning with a defined
> level of quotes in the commit message (the "level" beeing the number of
> '>' or '> ' found at the beginning of a line. Something like
>
> 	--strip-quotes[=N]
>
> where N is the level of quoted lines to remove (if "=N" is
> not given, assume that the level is 1 and remove all the quotes).

As Mark Brown has already said, that won't solve the issue for an 
introduction or comments added by the sender of the mail.
Also, people use all kinds of quoting schemes, not just leading ">".

And I've also seen plenty of cases where quoted lines _were_ a desired 
part of a commit log.

Thanks,
FJP

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

* Re: Add option in git-am to ignore leading text?
  2009-07-28 17:38   ` Frans Pop
@ 2009-07-28 18:15     ` Nicolas Sebrecht
  2009-07-28 19:11       ` Frans Pop
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Sebrecht @ 2009-07-28 18:15 UTC (permalink / raw)
  To: Frans Pop; +Cc: Nicolas Sebrecht, git

The 28/07/09, Frans Pop wrote:
> On Tuesday 28 July 2009, Nicolas Sebrecht wrote:
> 
> If my feature request is implemented I'll of course make sure to omit the
> '---' line if needed.

This is already done.

> Here are some other examples (some of which would equally need to drop or 
> change a separator line).
> http://lkml.org/lkml/2009/6/25/62

Uses "From:", "Date:", and "Subject:".

> http://lkml.org/lkml/2009/6/22/114

Uses "From:" and "Subject:".

> http://lkml.org/lkml/2009/6/30/109

Uses "Subject:" only.

I guess there are as results as contributors but it could be possible to
add some rules to the format. This could ending up with an unuseable
feature in practice, though. I don't know.

> http://lkml.org/lkml/2009/6/30/224

Broken link ?

> As Mark Brown has already said, that won't solve the issue for an 
> introduction or comments added by the sender of the mail.

True.

> Also, people use all kinds of quoting schemes, not just leading ">".

And people don't use the same rules with the "inline headers" too. :-)

> And I've also seen plenty of cases where quoted lines _were_ a desired 
> part of a commit log.

Yes, that's why it's an _option_.

-- 
Nicolas Sebrecht

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

* Re: Add option in git-am to ignore leading text?
  2009-07-28 18:15     ` Nicolas Sebrecht
@ 2009-07-28 19:11       ` Frans Pop
  2009-07-28 19:19         ` Frans Pop
  0 siblings, 1 reply; 7+ messages in thread
From: Frans Pop @ 2009-07-28 19:11 UTC (permalink / raw)
  To: Nicolas Sebrecht; +Cc: git

On Tuesday 28 July 2009, Nicolas Sebrecht wrote:
> > Here are some other examples (some of which would equally need to
> > drop or change a separator line).
> > http://lkml.org/lkml/2009/6/25/62
> Uses "From:", "Date:", and "Subject:".
>
> > http://lkml.org/lkml/2009/6/22/114
> Uses "From:" and "Subject:".
>
> > http://lkml.org/lkml/2009/6/30/109
> Uses "Subject:" only.
>
> I guess there are as results as contributors but it could be possible
> to add some rules to the format. This could ending up with an unuseable
> feature in practice, though. I don't know.

My proposal was "when it encounters _either_ a From: _or_ a Subject: 
pseudo header" which would work for all examples. But I fully agree with 
you that some rules are needed.
Whether to do the same on Date: is less obvious, but I doubt that would 
ever be seen without at least one of the others (and the rules could 
specify that).

> > http://lkml.org/lkml/2009/6/30/224
> Broken link ?

Works for me, just slow.

> > And I've also seen plenty of cases where quoted lines _were_ a
> > desired part of a commit log.
>
> Yes, that's why it's an _option_.

IMHO it does not add much. My proposal would be more generic exactly 
because it defines the pseudo headers as a natural separator between 
introduction and the part of the mail git-am should act on.

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

* Re: Add option in git-am to ignore leading text?
  2009-07-28 19:11       ` Frans Pop
@ 2009-07-28 19:19         ` Frans Pop
  0 siblings, 0 replies; 7+ messages in thread
From: Frans Pop @ 2009-07-28 19:19 UTC (permalink / raw)
  To: Nicolas Sebrecht; +Cc: git

On Tuesday 28 July 2009, Frans Pop wrote:
> Whether to do the same on Date: is less obvious, but I doubt that would
> ever be seen without at least one of the others (and the rules could
> specify that).

Hmm. Is a Date: pseudo header used at all? It isn't mentioned in the 
git-am man page, only From: and Subject: are.

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

end of thread, other threads:[~2009-07-28 19:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-28  3:13 Add option in git-am to ignore leading text? Frans Pop
2009-07-28 14:22 ` Nicolas Sebrecht
2009-07-28 14:31   ` Mark Brown
2009-07-28 17:38   ` Frans Pop
2009-07-28 18:15     ` Nicolas Sebrecht
2009-07-28 19:11       ` Frans Pop
2009-07-28 19:19         ` Frans Pop

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.