]> Kevux Git Server - rit/commit
apply: report the location of corrupt patches
authorJialong Wang <jerrywang183@yahoo.com>
Tue, 17 Mar 2026 16:23:19 +0000 (12:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Mar 2026 18:08:24 +0000 (11:08 -0700)
commitc5e15c9a58c0b32ec8be3ae96434834124de175e
tree08679ef3fea335dfbfd2672563b222a6acde4e1c
parentdc6ecd5354dca88d51b6d6562777fc8fc10d77e1
apply: report the location of corrupt patches

When parsing a corrupt patch, git apply reports only the line number.
That does not tell the user which input the line number refers to.

Include the patch input path in the error message so the reported
location is easier to use.

Reset the line number for each patch input so the reported location stays
correct when multiple input files are provided.

Add tests for file input, standard input, multiple patch inputs, and
existing binary-diff corrupt patch cases.

Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c
t/t4012-diff-binary.sh
t/t4100-apply-stat.sh