From 158620872737067e4a74ca7aed5302af8debb714 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Sun, 17 Jan 2010 03:05:10 +0100 Subject: builtin-apply.c: Skip filenames without enough components find_name() wrongly returned the whole filename for filenames without enough leading pathname components (e.g., when applying a patch to a top-level file with -p2). Include the -p value used in the error message when no filenames can be found. [jc: squashed a test from Nanako Shiraishi] Signed-off-by: Andreas Gruenbacher Signed-off-by: Junio C Hamano --- t/t4120-apply-popt.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't') diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh index 83d4ba6798..b463b4f05c 100755 --- a/t/t4120-apply-popt.sh +++ b/t/t4120-apply-popt.sh @@ -22,4 +22,9 @@ test_expect_success 'apply git diff with -p2' ' git apply -p2 patch.file ' +test_expect_success 'apply with too large -p' ' + test_must_fail git apply --stat -p3 patch.file 2>err && + grep "removing 3 leading" err +' + test_done -- cgit v1.2.1