graph: tidy up display of left-skewed merges
[git] / t / t4215-log-skewed-merges.sh
1 #!/bin/sh
2
3 test_description='git log --graph of skewed merges'
4
5 . ./test-lib.sh
6
7 test_expect_success 'log --graph with merge fusing with its left and right neighbors' '
8         cat >expect <<-\EOF &&
9         *   H
10         |\
11         | *   G
12         | |\
13         | | * F
14         | * \   E
15         |/|\ \
16         | | |/
17         | | * D
18         | * | C
19         | |/
20         * | B
21         |/
22         * A
23         EOF
24
25         git checkout --orphan _p &&
26         test_commit A &&
27         test_commit B &&
28         git checkout -b _q @^ && test_commit C &&
29         git checkout -b _r @^ && test_commit D &&
30         git checkout _p && git merge --no-ff _q _r -m E &&
31         git checkout _r && test_commit F &&
32         git checkout _p && git merge --no-ff _r -m G &&
33         git checkout @^^ && git merge --no-ff _p -m H &&
34
35         git log --graph --pretty=tformat:%s | sed "s/ *$//" >actual &&
36         test_cmp expect actual
37 '
38
39 test_expect_success 'log --graph with left-skewed merge' '
40         cat >expect <<-\EOF &&
41         *-----.   0_H
42         |\ \ \ \
43         | | | | * 0_G
44         | |_|_|/|
45         |/| | | |
46         | | | * \   0_F
47         | |_|/|\ \
48         |/| | | |/
49         | | | | * 0_E
50         | |_|_|/
51         |/| | |
52         | | * | 0_D
53         | | |/
54         | | * 0_C
55         | |/
56         |/|
57         | * 0_B
58         |/
59         * 0_A
60         EOF
61
62         git checkout --orphan 0_p && test_commit 0_A &&
63         git checkout -b 0_q 0_p && test_commit 0_B &&
64         git checkout -b 0_r 0_p &&
65         test_commit 0_C &&
66         test_commit 0_D &&
67         git checkout -b 0_s 0_p && test_commit 0_E &&
68         git checkout -b 0_t 0_p && git merge --no-ff 0_r^ 0_s -m 0_F &&
69         git checkout 0_p && git merge --no-ff 0_s -m 0_G &&
70         git checkout @^ && git merge --no-ff 0_q 0_r 0_t 0_p -m 0_H &&
71
72         git log --graph --pretty=tformat:%s | sed "s/ *$//" >actual &&
73         test_cmp expect actual
74 '
75
76 test_done