add-patch: do not show UI messages on stderr
[git/gitster.git] / t / t6401-merge-criss-cross.sh
blob1962310408b12209aef235b9d6e09b8049de5f60
1 #!/bin/sh
3 # Copyright (c) 2005 Fredrik Kuivinen
6 # See https://lore.kernel.org/git/Pine.LNX.4.44.0504271254120.4678-100000@wax.eds.org/ for a
7 # nice description of what this is about.
10 test_description='Test criss-cross merge'
12 TEST_PASSES_SANITIZE_LEAK=true
13 . ./test-lib.sh
15 test_expect_success 'prepare repository' '
16 test_write_lines 1 2 3 4 5 6 7 8 9 >file &&
17 git add file &&
18 git commit -m "Initial commit" file &&
20 git branch A &&
21 git branch B &&
22 git checkout A &&
24 test_write_lines 1 2 3 4 5 6 7 "8 changed in B8, branch A" 9 >file &&
25 git commit -m "B8" file &&
26 git checkout B &&
28 test_write_lines 1 2 "3 changed in C3, branch B" 4 5 6 7 8 9 >file &&
29 git commit -m "C3" file &&
30 git branch C3 &&
32 git merge -m "pre E3 merge" A &&
34 test_write_lines 1 2 "3 changed in E3, branch B. New file size" 4 5 6 7 "8 changed in B8, branch A" 9 >file &&
35 git commit -m "E3" file &&
37 git checkout A &&
38 git merge -m "pre D8 merge" C3 &&
39 test_write_lines 1 2 "3 changed in C3, branch B" 4 5 6 7 "8 changed in D8, branch A. New file size 2" 9 >file &&
41 git commit -m D8 file
44 test_expect_success 'Criss-cross merge' '
45 git merge -m "final merge" B
48 test_expect_success 'Criss-cross merge result' '
49 cat <<-\EOF >file-expect &&
52 3 changed in E3, branch B. New file size
57 8 changed in D8, branch A. New file size 2
59 EOF
61 test_cmp file-expect file
64 test_expect_success 'Criss-cross merge fails (-s resolve)' '
65 git reset --hard A^ &&
66 test_must_fail git merge -s resolve -m "final merge" B
69 test_done