Subject: Re: [BUG] incorrect line numbers reported in git am

From: Junio C Hamano <[email-masked]>
Date: Thu, 03 Oct 2019 04:44:55 +0900

Denton Liu <[email-masked]> 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.