From 9987d7c58a847ab1605ae3216ff1ca95b19f0ad1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 21 Feb 2007 14:31:10 -0800 Subject: git-apply: notice "diff --git" patch again Earlier one that tried to be too consistent with GNU patch by not stripping the leading path when we _know_ we are in a subdirectory and the patch is relative to the toplevel was a mistake. This fixes it. - No change to behaviour when it is run from the toplevel of the repository. - When run from a subdirectory to apply a git-generated patch, it uses the right -p value automatically, with or without --index nor --cached option. - When run from a subdirectory to apply a randomly generated patch, it wants the right -p value to be given by the user. The second one is a pure improvement to correct inconsistency between --index and non --index case, compared with 1.5.0. The third point could be further improved to guess what the right value for -p should be by looking at the patch, but should be a topic of a separate patch. Signed-off-by: Junio C Hamano --- t/t4119-apply-config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/t4119-apply-config.sh') diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh index f9b9425153..32e0d7172e 100755 --- a/t/t4119-apply-config.sh +++ b/t/t4119-apply-config.sh @@ -78,7 +78,7 @@ test_expect_success 'apply --whitespace=strip in subdir' ' git update-index --refresh && cd sub && - git apply --whitespace=strip -p2 ../patch.file && + git apply --whitespace=strip ../patch.file && if grep " " file1 then echo "Eh?" @@ -101,7 +101,7 @@ test_expect_success 'apply --whitespace=strip from config in subdir' ' git update-index --refresh && cd sub && - git apply -p2 ../patch.file && + git apply ../patch.file && if grep " " file1 then echo "Eh?" -- cgit v1.2.3