t4119: add test for traditional patch and different p_value
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
@ -18,6 +18,15 @@ test_expect_success setup '
|
|||||||
git diff >patch.file
|
git diff >patch.file
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# Also handcraft GNU diff output; note this has trailing whitespace.
|
||||||
|
cat >gpatch.file <<\EOF
|
||||||
|
--- file1 2007-02-21 01:04:24.000000000 -0800
|
||||||
|
+++ file1+ 2007-02-21 01:07:44.000000000 -0800
|
||||||
|
@@ -1 +1 @@
|
||||||
|
-A
|
||||||
|
+B
|
||||||
|
EOF
|
||||||
|
|
||||||
test_expect_success 'apply --whitespace=strip' '
|
test_expect_success 'apply --whitespace=strip' '
|
||||||
|
|
||||||
rm -f sub/file1 &&
|
rm -f sub/file1 &&
|
||||||
@ -29,8 +38,12 @@ test_expect_success 'apply --whitespace=strip' '
|
|||||||
then
|
then
|
||||||
echo "Eh?"
|
echo "Eh?"
|
||||||
false
|
false
|
||||||
else
|
elif grep B sub/file1
|
||||||
|
then
|
||||||
echo Happy
|
echo Happy
|
||||||
|
else
|
||||||
|
echo "Huh?"
|
||||||
|
false
|
||||||
fi
|
fi
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -46,6 +59,9 @@ test_expect_success 'apply --whitespace=strip from config' '
|
|||||||
then
|
then
|
||||||
echo "Eh?"
|
echo "Eh?"
|
||||||
false
|
false
|
||||||
|
elif grep B sub/file1
|
||||||
|
then
|
||||||
|
echo Happy
|
||||||
else
|
else
|
||||||
echo Happy
|
echo Happy
|
||||||
fi
|
fi
|
||||||
@ -67,8 +83,12 @@ test_expect_success 'apply --whitespace=strip in subdir' '
|
|||||||
then
|
then
|
||||||
echo "Eh?"
|
echo "Eh?"
|
||||||
false
|
false
|
||||||
else
|
elif grep B file1
|
||||||
|
then
|
||||||
echo Happy
|
echo Happy
|
||||||
|
else
|
||||||
|
echo "Huh?"
|
||||||
|
false
|
||||||
fi
|
fi
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -86,8 +106,35 @@ test_expect_success 'apply --whitespace=strip from config in subdir' '
|
|||||||
then
|
then
|
||||||
echo "Eh?"
|
echo "Eh?"
|
||||||
false
|
false
|
||||||
else
|
elif grep B file1
|
||||||
|
then
|
||||||
echo Happy
|
echo Happy
|
||||||
|
else
|
||||||
|
echo "Huh?"
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'same in subdir but with traditional patch input' '
|
||||||
|
|
||||||
|
cd "$D" &&
|
||||||
|
git config apply.whitespace strip &&
|
||||||
|
rm -f sub/file1 &&
|
||||||
|
cp saved sub/file1 &&
|
||||||
|
git update-index --refresh &&
|
||||||
|
|
||||||
|
cd sub &&
|
||||||
|
git apply -p0 ../gpatch.file &&
|
||||||
|
if grep " " file1
|
||||||
|
then
|
||||||
|
echo "Eh?"
|
||||||
|
false
|
||||||
|
elif grep B file1
|
||||||
|
then
|
||||||
|
echo Happy
|
||||||
|
else
|
||||||
|
echo "Huh?"
|
||||||
|
false
|
||||||
fi
|
fi
|
||||||
'
|
'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user