@matheusbsbs / matheus-bagliano / commits / 583942df09
Fork 0

t6036: Add a second testcase similar to the first but with content changes

c94736a (merge-recursive: don't segfault while handling rename clashes 2009-07-30) added t6036 with a testcase that involved dual renames and a criss-cross merge. Add a test that is nearly identical, but which also involves content modification -- a case git currently does not merge correctly. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Sep 20, 2010 at 02:28 UTC 583942df098b04f545fb6bbe7b0d1590cc7b7b1d
1 file changed +76
t/t6036-recursive-corner-cases.sh
+76
@@ -70,4 +70,80 @@ test_expect_success 'merge simple rename+criss-cross with no modifications' '
70 test $(git rev-parse :1:three) = $(git hash-object merged)
71 '
72
73 +#
74 +# Same as before, but modify L1 slightly:
75 +#
76 +# L1m L2
77 +# o---o
78 +# / \ / \
79 +# o X ?
80 +# \ / \ /
81 +# o---o
82 +# R1 R2
83 +#
84 +
85 +test_expect_success 'setup criss-cross + rename merges with basic modification' '
86 + git rm -rf . &&
87 + git clean -fdqx &&
88 + rm -rf .git &&
89 + git init &&
90 +
91 + ten="0 1 2 3 4 5 6 7 8 9"
92 + for i in $ten
93 + do
94 + echo line $i in a sample file
95 + done >one &&
96 + for i in $ten
97 + do
98 + echo line $i in another sample file
99 + done >two &&
100 + git add one two &&
101 + test_tick && git commit -m initial &&
102 +
103 + git branch L1 &&
104 + git checkout -b R1 &&
105 + git mv one three &&
106 + echo more >>two &&
107 + git add two &&
108 + test_tick && git commit -m R1 &&
109 +
110 + git checkout L1 &&
111 + git mv two three &&
112 + test_tick && git commit -m L1 &&
113 +
114 + git checkout L1^0 &&
115 + test_tick && git merge -s ours R1 &&
116 + git tag L2 &&
117 +
118 + git checkout R1^0 &&
119 + test_tick && git merge -s ours L1 &&
120 + git tag R2
121 +'
122 +
123 +test_expect_failure 'merge criss-cross + rename merges with basic modification' '
124 + git reset --hard &&
125 + git checkout L2^0 &&
126 +
127 + test_must_fail git merge -s recursive R2^0 &&
128 +
129 + test 5 = $(git ls-files -s | wc -l) &&
130 + test 3 = $(git ls-files -u | wc -l) &&
131 + test 0 = $(git ls-files -o | wc -l) &&
132 +
133 + test $(git rev-parse :0:one) = $(git rev-parse L2:one) &&
134 + test $(git rev-parse :0:two) = $(git rev-parse R2:two) &&
135 + test $(git rev-parse :2:three) = $(git rev-parse L2:three) &&
136 + test $(git rev-parse :3:three) = $(git rev-parse R2:three) &&
137 +
138 + head -n 10 two >merged &&
139 + cp one merge-me &&
140 + >empty &&
141 + test_must_fail git merge-file \
142 + -L "Temporary merge branch 2" \
143 + -L "" \
144 + -L "Temporary merge branch 1" \
145 + merged empty merge-me &&
146 + test $(git rev-parse :1:three) = $(git hash-object merged)
147 +'
148 +
149 test_done