Jeff Garzik <jeff@xxxxxxxxxx> writes: > I ran > > git-am --signoff --utf8 /g/tmp/mbox > > on the attached file, to apply a patch to libata-dev.git#upstream, and > it wound up only applying a portion of the patch: > >> [jgarzik@pretzel libata-dev]$ git-am --signoff --utf8 /g/tmp/mbox >> >> Applying 'Add pci class code for SATA AHCI' >> >> error: patch fragment without header at line 35: @@ -862,7 +862,7 @@ >> error: patch fragment without header at line 50: @@ -15,6 +15,8 @@ >> Wrote tree 5d6f3a93bea932c950ac880deca173dd3e84dfcc >> Committed: 317b180bad43133027dc07455f1600f4e8a47d76 > > It seems quite bad to apply a patch that git-am KNOWS is incomplete. Quite true. This turns out to be quite an old bug (dates back to May 2005). I've scanned builtin-apply.c while coming up with this fix to see if there other "detected but ignored" errors, but it appears this is the only one. Sorry for the trouble and thanks for the report. -- >8 -- [PATCH] Do not ignore a detected patchfile brokenness. find_header() function is used to read and parse the patchfile and it detects errors in the patch, but one place ignored the error and went ahead, which was quite bad. Noticed by Jeff Garzik. Signed-off-by: Junio C Hamano <junkio@xxxxxxx> --- diff --git a/builtin-apply.c b/builtin-apply.c index 1c35837..918822b 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -811,7 +811,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc struct fragment dummy; if (parse_fragment_header(line, len, &dummy) < 0) continue; - error("patch fragment without header at line %d: %.*s", linenr, (int)len-1, line); + return error("patch fragment without header at line %d: %.*s", linenr, (int)len-1, line); } if (size < len + 6) - 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