diff options
| author | Jialong Wang <jerrywang183@yahoo.com> | 2026-03-17 12:23:19 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-17 11:08:24 -0700 |
| commit | c5e15c9a58c0b32ec8be3ae96434834124de175e (patch) | |
| tree | 08679ef3fea335dfbfd2672563b222a6acde4e1c /t/t4012-diff-binary.sh | |
| parent | dc6ecd5354dca88d51b6d6562777fc8fc10d77e1 (diff) | |
| download | git-c5e15c9a58c0b32ec8be3ae96434834124de175e.tar.xz | |
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>
Diffstat (limited to 't/t4012-diff-binary.sh')
| -rwxr-xr-x | t/t4012-diff-binary.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh index d1d30ac2a9..97b5ac0407 100755 --- a/t/t4012-diff-binary.sh +++ b/t/t4012-diff-binary.sh @@ -68,7 +68,7 @@ test_expect_success 'apply detecting corrupt patch correctly' ' sed -e "s/-CIT/xCIT/" <output >broken && test_must_fail git apply --stat --summary broken 2>detected && detected=$(cat detected) && - detected=$(expr "$detected" : "error.*at line \\([0-9]*\\)\$") && + detected=$(expr "$detected" : "error.*broken:\\([0-9]*\\)\$") && detected=$(sed -ne "${detected}p" broken) && test "$detected" = xCIT ' @@ -77,7 +77,7 @@ test_expect_success 'apply detecting corrupt patch correctly' ' git diff --binary | sed -e "s/-CIT/xCIT/" >broken && test_must_fail git apply --stat --summary broken 2>detected && detected=$(cat detected) && - detected=$(expr "$detected" : "error.*at line \\([0-9]*\\)\$") && + detected=$(expr "$detected" : "error.*broken:\\([0-9]*\\)\$") && detected=$(sed -ne "${detected}p" broken) && test "$detected" = xCIT ' |
