]> git.ipfire.org Git - thirdparty/git.git/blame - t/t6401-merge-criss-cross.sh
Merge branch 'tb/make-indent-conditional-with-non-spaces'
[thirdparty/git.git] / t / t6401-merge-criss-cross.sh
CommitLineData
70574634
FK
1#!/bin/sh
2#
3# Copyright (c) 2005 Fredrik Kuivinen
4#
5
dcee0372 6# See https://lore.kernel.org/git/Pine.LNX.4.44.0504271254120.4678-100000@wax.eds.org/ for a
82e5a82f 7# nice description of what this is about.
70574634
FK
8
9
10test_description='Test criss-cross merge'
e84a26e3
ÆAB
11
12TEST_PASSES_SANITIZE_LEAK=true
70574634
FK
13. ./test-lib.sh
14
42d180dd
EN
15test_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 &&
19
20 git branch A &&
21 git branch B &&
22 git checkout A &&
23
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 &&
27
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 &&
31
32 git merge -m "pre E3 merge" A &&
33
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 &&
36
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 &&
40
41 git commit -m D8 file
42'
43
44test_expect_success 'Criss-cross merge' '
45 git merge -m "final merge" B
46'
47
48test_expect_success 'Criss-cross merge result' '
49 cat <<-\EOF >file-expect &&
50 1
51 2
52 3 changed in E3, branch B. New file size
53 4
54 5
55 6
56 7
57 8 changed in D8, branch A. New file size 2
58 9
59 EOF
60
61 test_cmp file-expect file
62'
63
64test_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
67'
8ec0dd66 68
70574634 69test_done