Skip to content

Commit aae1f6a

Browse files
committed
test: git-apply -p2 rename/chmod only
Signed-off-by: Junio C Hamano <[email protected]>
1 parent cefd43b commit aae1f6a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

t/t4120-apply-popt.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,30 @@ test_expect_success 'apply with too large -p and fancy filename' '
5656
grep "removing 3 leading" err
5757
'
5858

59+
test_expect_success 'apply (-p2) diff, mode change only' '
60+
cat >patch.chmod <<-\EOF &&
61+
diff --git a/sub/file1 b/sub/file1
62+
old mode 100644
63+
new mode 100755
64+
EOF
65+
chmod 644 file1 &&
66+
git apply -p2 patch.chmod &&
67+
test -x file1
68+
'
69+
70+
test_expect_success 'apply (-p2) diff, rename' '
71+
cat >patch.rename <<-\EOF &&
72+
diff --git a/sub/file1 b/sub/file2
73+
similarity index 100%
74+
rename from sub/file1
75+
rename to sub/file2
76+
EOF
77+
echo A >expected &&
78+
79+
cp file1.saved file1 &&
80+
rm -f file2 &&
81+
git apply -p2 patch.rename &&
82+
test_cmp expected file2
83+
'
84+
5985
test_done

0 commit comments

Comments
 (0)