@@ -259,6 +259,57 @@ EXPECTED
259
259
test_cmp expected actual
260
260
'
261
261
262
+ test_expect_success ' tree add A, B (same)' '
263
+ cat >expect <<-\EOF &&
264
+ EOF
265
+ git reset --hard initial &&
266
+ mkdir sub &&
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
270
+ '
271
+
272
+ test_expect_success ' tree add A, B (different)' '
273
+ cat >expect <<-\EOF &&
274
+ added in both
275
+ our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
276
+ their 100644 ba629238ca89489f2b350e196ca445e09d8bb834 sub/file
277
+ @@ -1 +1,5 @@
278
+ +<<<<<<< .our
279
+ AAA
280
+ +=======
281
+ +BBB
282
+ +>>>>>>> .their
283
+ EOF
284
+ git reset --hard initial &&
285
+ mkdir sub &&
286
+ test_commit "add sub/file" "sub/file" "AAA" add-tree-a-b-A &&
287
+ git reset --hard initial &&
288
+ mkdir sub &&
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
292
+ '
293
+
294
+ test_expect_success ' tree unchanged A, removed B' '
295
+ cat >expect <<-\EOF &&
296
+ removed in remote
297
+ base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
298
+ our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
299
+ @@ -1 +0,0 @@
300
+ -AAA
301
+ EOF
302
+ git reset --hard initial &&
303
+ mkdir sub &&
304
+ test_commit "add sub/file" "sub/file" "AAA" tree-remove-b-initial &&
305
+ git rm sub/file &&
306
+ test_tick &&
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
311
+ '
312
+
262
313
test_expect_success ' turn file to tree' '
263
314
git reset --hard initial &&
264
315
rm initial-file &&
0 commit comments