3 test_description='git log --graph of skewed merges'
7 test_expect_success 'log --graph with merge fusing with its left and right neighbors' '
25 git checkout --orphan _p &&
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 &&
35 git log --graph --pretty=tformat:%s | sed "s/ *$//" >actual &&
36 test_cmp expect actual
39 test_expect_success 'log --graph with left-skewed merge' '
40 cat >expect <<-\EOF &&
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 &&
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 &&
72 git log --graph --pretty=tformat:%s | sed "s/ *$//" >actual &&
73 test_cmp expect actual
76 test_expect_success 'log --graph with nested left-skewed merge' '
77 cat >expect <<-\EOF &&
93 git checkout --orphan 1_p &&
97 git checkout -b 1_q @^ && test_commit 1_D &&
98 git checkout 1_p && git merge --no-ff 1_q -m 1_E &&
99 git checkout -b 1_r @~3 && test_commit 1_F &&
100 git checkout 1_p && git merge --no-ff 1_r -m 1_G &&
101 git checkout @^^ && git merge --no-ff 1_p -m 1_H &&
103 git log --graph --pretty=tformat:%s | sed "s/ *$//" >actual &&
104 test_cmp expect actual
107 test_expect_success 'log --graph with nested left-skewed merge following normal merge' '
108 cat >expect <<-\EOF &&
129 git checkout --orphan 2_p &&
133 git checkout -b 2_q @^^ &&
136 git checkout -b 2_r @^ && test_commit 2_F &&
138 git merge --no-ff 2_r -m 2_G &&
139 git merge --no-ff 2_p^ -m 2_H &&
140 git checkout -b 2_s @^^ && git merge --no-ff 2_q -m 2_J &&
141 git checkout 2_p && git merge --no-ff 2_s -m 2_K &&
143 git log --graph --pretty=tformat:%s | sed "s/ *$//" >actual &&
144 test_cmp expect actual
147 test_expect_success 'log --graph with nested right-skewed merge following left-skewed merge' '
148 cat >expect <<-\EOF &&
167 git checkout --orphan 3_p &&
169 git checkout -b 3_q &&
172 git checkout -b 3_r @^ &&
174 git checkout 3_q && git merge --no-ff 3_r -m 3_E &&
175 git checkout 3_p && git merge --no-ff 3_q -m 3_F &&
176 git checkout 3_r && test_commit 3_G &&
177 git checkout 3_p && git merge --no-ff 3_r -m 3_H &&
178 git checkout @^^ && git merge --no-ff 3_p -m 3_J &&
180 git log --graph --pretty=tformat:%s | sed "s/ *$//" >actual &&
181 test_cmp expect actual
184 test_expect_success 'log --graph with right-skewed merge following a left-skewed one' '
185 cat >expect <<-\EOF &&
204 git checkout --orphan 4_p &&
208 git checkout -b 4_q @^^ && test_commit 4_D &&
209 git checkout -b 4_r 4_p^ && git merge --no-ff 4_q -m 4_E &&
210 git checkout -b 4_s 4_p^^ &&
211 git merge --no-ff 4_r -m 4_F &&
212 git merge --no-ff 4_p -m 4_G &&
213 git checkout @^^ && git merge --no-ff 4_s -m 4_H &&
215 git log --graph --date-order --pretty=tformat:%s | sed "s/ *$//" >actual &&
216 test_cmp expect actual