git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Lukas Sandström" <luksan@gmail.com>
Cc: Philip Hofstetter <phofstetter@sensational.ch>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: [PATCH v2] git am/mailinfo: Don't look at in-body headers when rebasing
Date: Thu, 19 Nov 2009 10:36:23 -0500	[thread overview]
Message-ID: <20091119153622.GC6877@coredump.intra.peff.net> (raw)
In-Reply-To: <4B050718.8070506@gmail.com>

On Thu, Nov 19, 2009 at 09:51:36AM +0100, Lukas Sandström wrote:

> When we are rebasing we know that the header lines in the
> patch are good and that we don't need to pick up any headers
> from the body of the patch.
> 
> This makes it possible to rebase commits whose commit message
> start with "From" or "Date".
> 
> Test vectors by Jeff King.

Thanks, it did end up being a pretty small change. Though I think we may
be better off with _both_ patches. Your patch protects the message
absolutely during rebasing, and my patch improves the heuristic when
applying non-rebase patches.

> @@ -771,6 +772,8 @@ static int handle_commit_msg(struct strbuf *line)
>  		return 0;
> 
>  	if (still_looking) {
> +		if (!use_inbody_headers)
> +			still_looking = 0;
>  		strbuf_ltrim(line);
>  		if (!line->len)
>  			return 0;

Hmm. But we still end up in this conditional for the very first line.
Which I guess happens to work because the first line we feed is
presumably the empty blank line (but I didn't check). Still, wouldn't it
be more clear as:

  if (use_inbody_headers && still_looking) {
     ...

in which case still_looking simply becomes irrelevant when the feature
is disabled?

> +From nobody Mon Sep 17 00:00:00 2001
> +From: A U Thor <a.u.thor@example.com>
> +Subject: check bogus body header (from)
> +Date: Fri, 9 Jun 2006 00:44:16 -0700
> +
> +From: bogosity
> +  - a list
> +  - of stuff
> +---

Since your feature is meant to prevent us looking at inbody headers no
matter if they are valid-looking or not, wouldn't a better test be to
actually have:

  From: Other Author <other@example.com>

Otherwise, you don't know if it is your feature blocking it, or my patch
(if it gets applied on top).

> +From nobody Mon Sep 17 00:00:00 2001
> +From: A U Thor <a.u.thor@example.com>
> +Subject: check bogus body header (date)
> +Date: Fri, 9 Jun 2006 00:44:16 -0700
> +
> +Date: bogus
> +
> +and some content
> +

And ditto for the Date here.

-Peff

  reply	other threads:[~2009-11-19 15:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18 14:20 git-mailinfo doesn't stop parsing at the end of the header Philip Hofstetter
2009-11-18 15:51 ` Jeff King
2009-11-18 16:42   ` Jeff King
2009-11-18 22:45     ` [PATCH] git am/mailinfo: Don't look at in-body headers when rebasing Lukas Sandström
2009-11-18 23:47       ` Philip Hofstetter
2009-11-19  8:51         ` [PATCH v2] " Lukas Sandström
2009-11-19 15:36           ` Jeff King [this message]
2009-11-20 16:12             ` [PATCH] " Lukas Sandström
2009-11-18 17:11   ` git-mailinfo doesn't stop parsing at the end of the header Philip Hofstetter
2009-11-18 17:24     ` Jeff King
2009-11-18 17:46       ` Jakub Narebski
2009-11-18 18:42         ` Jeff King
2009-11-18 19:57       ` Philip Hofstetter

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=20091119153622.GC6877@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=luksan@gmail.com \
    --cc=phofstetter@sensational.ch \
    /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).