Re: [PATCH v2 1/2] Allow git-apply to ignore the hunk headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, 5 Jun 2008, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:
> 
> >> And the robustness issue I worry about the second point also applies to 
> >> a line that is "^-- $", especially if we were to make this available to 
> >> git-am.  Perhaps when the line begins with a '-', the logic could be 
> >> extra careful to detect the case where the line looks like the e-mail 
> >> signature separator and check one line beyond it to see if it does not 
> >> look anything like part of a diff (in which case you stop, without 
> >> considering the line you are currently looking at, "^-- $", a deletion 
> >> of "^- $", as part of the preimage context).
> >
> > Is this really an issue?  fixup_counts() is only called after a hunk 
> > header was read, and that should be well after any "^-- $".
> 
> Are you talking about "^-- $" or "^---$"?  Yes we are way past the 
> three-dash separator at this point, but e-mail signature separator 
> happens at the very end after the patch.

Oh yes, I was thinking about the "^---$".

> You read a hunk header line "@@ -l,m +n,o @@", and start counting the 
> diff text because you do not trust m and o.  When you read the last hunk 
> in a patch e-mail, you may hit a e-mail signature separator, like what 
> is given by format-patch output at the end.  Mistaking that as an extra 
> preimage context to remove "^- $" is what I was worried about.
> 
> -- 
> I worry, therefore I am...

Nice signature...

I could check for garbage after a line that consists of exactly "^-- $" 
with something like this (on top of 1/2):

@@ -0,0 +0,0 @@
 	default:
-		return -1;
+		return len != 4 && memcmp(line - len, "-- \n", len);
 	}

Hmm?

However, this will not work if anybody has a signature starting with 
"@@ ", "+", " ", "-" or "diff "...

Ciao,
Dscho

-- 
Won't dorry, he bappy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux