39
37
test_expect_success 'file add A, B (same)' '
40
38
cat >expected <<\EXPECTED &&
42
our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
43
their 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
46
41
git reset --hard initial &&
182
177
test_expect_success 'file remove A, !B' '
183
178
cat >expected <<\EXPECTED &&
185
base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
186
their 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ONE
189
181
git reset --hard initial &&
213
205
test_cmp expected actual
208
test_expect_success 'file remove A, B (same)' '
209
cat >expected <<\EXPECTED &&
212
git reset --hard initial &&
213
test_commit "rm-a-b-base" "ONE" "AAA" &&
215
git commit -m "rm-a-b" &&
217
git merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&
218
test_cmp expected actual
216
221
test_expect_success 'file change A, remove B' '
217
222
cat >expected <<\EXPECTED &&
218
223
removed in remote
254
259
test_cmp expected actual
262
test_expect_success 'tree add A, B (same)' '
263
cat >expect <<-\EOF &&
265
git reset --hard initial &&
267
test_commit "add sub/file" "sub/file" "file" add-tree-A &&
268
git merge-tree initial add-tree-A add-tree-A >actual &&
269
test_cmp expect actual
272
test_expect_success 'tree add A, B (different)' '
273
cat >expect <<-\EOF &&
275
our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
276
their 100644 ba629238ca89489f2b350e196ca445e09d8bb834 sub/file
284
git reset --hard initial &&
286
test_commit "add sub/file" "sub/file" "AAA" add-tree-a-b-A &&
287
git reset --hard initial &&
289
test_commit "add sub/file" "sub/file" "BBB" add-tree-a-b-B &&
290
git merge-tree initial add-tree-a-b-A add-tree-a-b-B >actual &&
291
test_cmp expect actual
294
test_expect_success 'tree unchanged A, removed B' '
295
cat >expect <<-\EOF &&
297
base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
298
our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
302
git reset --hard initial &&
304
test_commit "add sub/file" "sub/file" "AAA" tree-remove-b-initial &&
307
git commit -m "remove sub/file" &&
308
git tag tree-remove-b-B &&
309
git merge-tree tree-remove-b-initial tree-remove-b-initial tree-remove-b-B >actual &&
310
test_cmp expect actual
313
test_expect_success 'turn file to tree' '
314
git reset --hard initial &&
316
mkdir initial-file &&
317
test_commit "turn-file-to-tree" "initial-file/ONE" "CCC" &&
318
git merge-tree initial initial turn-file-to-tree >actual &&
319
cat >expect <<-\EOF &&
321
their 100644 43aa4fdec31eb92e1fdc2f0ce6ea9ddb7c32bcf7 initial-file/ONE
325
base 100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file
326
our 100644 e79c5e8f964493290a409888d5413a737e8e5dd5 initial-file
330
test_cmp expect actual
333
test_expect_success 'turn tree to file' '
334
git reset --hard initial &&
336
test_commit "add-tree" "dir/path" "AAA" &&
337
test_commit "add-another-tree" "dir/another" "BBB" &&
339
test_commit "make-file" "dir" "CCC" &&
340
git merge-tree add-tree add-another-tree make-file >actual &&
341
cat >expect <<-\EOF &&
343
base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d dir/path
344
our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d dir/path
348
their 100644 43aa4fdec31eb92e1fdc2f0ce6ea9ddb7c32bcf7 dir
352
test_cmp expect actual