Re: [BUG] incorrect line numbers reported in git am
To
Denton Liu
Cc
git@vger.kernel.org
Paul Tan
Nguyễn Thái Ngọc Duy
Jeff King
From
Junio C Hamano
See Also
Prev
Date
2019-10-02 19:44:55 UTC
Denton Liu <liu.denton@gmail.com> writes:

> 	Applying: dir: special case check for the possibility that pathspec is NULL
> 	error: corrupt patch at line 87

This refers to line 87 of the input file, not a line that begins
with "@@ -87,count...", doesn't it?  If the sender hand edits a
patch without correcting the number of lines recorded in the hunk
header, the parser may not see the next hunk that begins with "@@"
or run out of the input before it reads the required number of lines
given the last hunk header.

We might be able to notice when the input file is shorter than the
last hunk wants it to be, in which case we should be able to say
'premature end of input at line 87' or something like that.