@matheusbsbs / matheus-bagliano / commits / aae1f6acf1
Fork 0

test: git-apply -p2 rename/chmod only

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Oct 21, 2010 at 22:09 UTC aae1f6acf1984f4ae4453ad299a1fa4d261fb188
1 file changed +26
t/t4120-apply-popt.sh
+26
@@ -56,4 +56,30 @@ test_expect_success 'apply with too large -p and fancy filename' '
56 grep "removing 3 leading" err
57 '
58
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 +
85 test_done