Skip to content

Commit 05b32dc

Browse files
abhishekkumar2718gitster
authored andcommitted
t4214: use lib-log-graph functions
Helped-by: Johannes Schindelin <[email protected]> Signed-off-by: Abhishek Kumar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 853608f commit 05b32dc

File tree

1 file changed

+19
-67
lines changed

1 file changed

+19
-67
lines changed

t/t4214-log-graph-octopus.sh

Lines changed: 19 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
test_description='git log --graph of skewed left octopus merge.'
44

55
. ./test-lib.sh
6+
. "$TEST_DIRECTORY"/lib-log-graph.sh
67

78
test_expect_success 'set up merge history' '
89
test_commit initial &&
@@ -24,7 +25,7 @@ test_expect_success 'set up merge history' '
2425
'
2526

2627
test_expect_success 'log --graph with tricky octopus merge, no color' '
27-
cat >expect.uncolored <<-\EOF &&
28+
test_cmp_graph --pretty=tformat:%s --color=never --date-order left octopus-merge <<-\EOF
2829
* left
2930
| *-. octopus-merge
3031
|/|\ \
@@ -37,14 +38,11 @@ test_expect_success 'log --graph with tricky octopus merge, no color' '
3738
|/
3839
* initial
3940
EOF
40-
git log --color=never --graph --date-order --pretty=tformat:%s left octopus-merge >actual.raw &&
41-
sed "s/ *\$//" actual.raw >actual &&
42-
test_cmp expect.uncolored actual
4341
'
4442

4543
test_expect_success 'log --graph with tricky octopus merge with colors' '
4644
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
47-
cat >expect.colors <<-\EOF &&
45+
test_cmp_colored_graph --pretty=tformat:%s --date-order left octopus-merge <<-\EOF
4846
* left
4947
<RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
5048
<RED>|<RESET><RED>/<RESET><YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET>
@@ -57,16 +55,13 @@ test_expect_success 'log --graph with tricky octopus merge with colors' '
5755
<MAGENTA>|<RESET><MAGENTA>/<RESET>
5856
* initial
5957
EOF
60-
git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
61-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
62-
test_cmp expect.colors actual.colors
6358
'
6459

6560
# Repeat the previous two tests with "normal" octopus merge (i.e.,
6661
# without the first parent skewing to the "left" branch column).
6762

6863
test_expect_success 'log --graph with normal octopus merge, no color' '
69-
cat >expect.uncolored <<-\EOF &&
64+
test_cmp_graph --pretty=tformat:%s --color=never --date-order octopus-merge <<-\EOF
7065
*---. octopus-merge
7166
|\ \ \
7267
| | | * 4
@@ -78,13 +73,11 @@ test_expect_success 'log --graph with normal octopus merge, no color' '
7873
|/
7974
* initial
8075
EOF
81-
git log --color=never --graph --date-order --pretty=tformat:%s octopus-merge >actual.raw &&
82-
sed "s/ *\$//" actual.raw >actual &&
83-
test_cmp expect.uncolored actual
8476
'
8577

8678
test_expect_success 'log --graph with normal octopus merge with colors' '
87-
cat >expect.colors <<-\EOF &&
79+
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
80+
test_cmp_colored_graph --pretty=tformat:%s --date-order octopus-merge <<-\EOF
8881
*<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET> octopus-merge
8982
<RED>|<RESET><GREEN>\<RESET> <YELLOW>\<RESET> <BLUE>\<RESET>
9083
<RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4
@@ -96,14 +89,10 @@ test_expect_success 'log --graph with normal octopus merge with colors' '
9689
<BLUE>|<RESET><BLUE>/<RESET>
9790
* initial
9891
EOF
99-
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
100-
git log --color=always --graph --date-order --pretty=tformat:%s octopus-merge >actual.colors.raw &&
101-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
102-
test_cmp expect.colors actual.colors
10392
'
10493

10594
test_expect_success 'log --graph with normal octopus merge and child, no color' '
106-
cat >expect.uncolored <<-\EOF &&
95+
test_cmp_graph --pretty=tformat:%s --color=never --date-order after-merge <<-\EOF
10796
* after-merge
10897
*---. octopus-merge
10998
|\ \ \
@@ -116,13 +105,11 @@ test_expect_success 'log --graph with normal octopus merge and child, no color'
116105
|/
117106
* initial
118107
EOF
119-
git log --color=never --graph --date-order --pretty=tformat:%s after-merge >actual.raw &&
120-
sed "s/ *\$//" actual.raw >actual &&
121-
test_cmp expect.uncolored actual
122108
'
123109

124110
test_expect_success 'log --graph with normal octopus and child merge with colors' '
125-
cat >expect.colors <<-\EOF &&
111+
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
112+
test_cmp_colored_graph --pretty=tformat:%s --date-order after-merge <<-\EOF
126113
* after-merge
127114
*<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
128115
<GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
@@ -135,14 +122,10 @@ test_expect_success 'log --graph with normal octopus and child merge with colors
135122
<MAGENTA>|<RESET><MAGENTA>/<RESET>
136123
* initial
137124
EOF
138-
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
139-
git log --color=always --graph --date-order --pretty=tformat:%s after-merge >actual.colors.raw &&
140-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
141-
test_cmp expect.colors actual.colors
142125
'
143126

144127
test_expect_success 'log --graph with tricky octopus merge and its child, no color' '
145-
cat >expect.uncolored <<-\EOF &&
128+
test_cmp_graph --pretty=tformat:%s --color=never --date-order left after-merge <<-\EOF
146129
* left
147130
| * after-merge
148131
| *-. octopus-merge
@@ -156,14 +139,10 @@ test_expect_success 'log --graph with tricky octopus merge and its child, no col
156139
|/
157140
* initial
158141
EOF
159-
git log --color=never --graph --date-order --pretty=tformat:%s left after-merge >actual.raw &&
160-
sed "s/ *\$//" actual.raw >actual &&
161-
test_cmp expect.uncolored actual
162142
'
163143

164144
test_expect_success 'log --graph with tricky octopus merge and its child with colors' '
165-
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
166-
cat >expect.colors <<-\EOF &&
145+
test_cmp_colored_graph --pretty=tformat:%s --date-order left after-merge <<-\EOF
167146
* left
168147
<RED>|<RESET> * after-merge
169148
<RED>|<RESET> *<CYAN>-<RESET><CYAN>.<RESET> octopus-merge
@@ -177,13 +156,10 @@ test_expect_success 'log --graph with tricky octopus merge and its child with co
177156
<CYAN>|<RESET><CYAN>/<RESET>
178157
* initial
179158
EOF
180-
git log --color=always --graph --date-order --pretty=tformat:%s left after-merge >actual.colors.raw &&
181-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
182-
test_cmp expect.colors actual.colors
183159
'
184160

185161
test_expect_success 'log --graph with crossover in octopus merge, no color' '
186-
cat >expect.uncolored <<-\EOF &&
162+
test_cmp_graph --pretty=tformat:%s --date-order after-4 octopus-merge <<-\EOF
187163
* after-4
188164
| *---. octopus-merge
189165
| |\ \ \
@@ -200,14 +176,11 @@ test_expect_success 'log --graph with crossover in octopus merge, no color' '
200176
|/
201177
* initial
202178
EOF
203-
git log --color=never --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.raw &&
204-
sed "s/ *\$//" actual.raw >actual &&
205-
test_cmp expect.uncolored actual
206179
'
207180

208181
test_expect_success 'log --graph with crossover in octopus merge with colors' '
209182
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
210-
cat >expect.colors <<-\EOF &&
183+
test_cmp_colored_graph --pretty=tformat:%s --date-order after-4 octopus-merge <<-\EOF
211184
* after-4
212185
<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
213186
<RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <RED>\<RESET>
@@ -224,13 +197,10 @@ test_expect_success 'log --graph with crossover in octopus merge with colors' '
224197
<MAGENTA>|<RESET><MAGENTA>/<RESET>
225198
* initial
226199
EOF
227-
git log --color=always --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.colors.raw &&
228-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
229-
test_cmp expect.colors actual.colors
230200
'
231201

232202
test_expect_success 'log --graph with crossover in octopus merge and its child, no color' '
233-
cat >expect.uncolored <<-\EOF &&
203+
test_cmp_graph --pretty=tformat:%s --date-order after-4 after-merge <<-\EOF
234204
* after-4
235205
| * after-merge
236206
| *---. octopus-merge
@@ -248,14 +218,11 @@ test_expect_success 'log --graph with crossover in octopus merge and its child,
248218
|/
249219
* initial
250220
EOF
251-
git log --color=never --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.raw &&
252-
sed "s/ *\$//" actual.raw >actual &&
253-
test_cmp expect.uncolored actual
254221
'
255222

256223
test_expect_success 'log --graph with crossover in octopus merge and its child with colors' '
257224
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
258-
cat >expect.colors <<-\EOF &&
225+
test_cmp_colored_graph --pretty=tformat:%s --date-order after-4 after-merge <<-\EOF
259226
* after-4
260227
<RED>|<RESET> * after-merge
261228
<RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
@@ -273,13 +240,10 @@ test_expect_success 'log --graph with crossover in octopus merge and its child w
273240
<CYAN>|<RESET><CYAN>/<RESET>
274241
* initial
275242
EOF
276-
git log --color=always --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.colors.raw &&
277-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
278-
test_cmp expect.colors actual.colors
279243
'
280244

281245
test_expect_success 'log --graph with unrelated commit and octopus tip, no color' '
282-
cat >expect.uncolored <<-\EOF &&
246+
test_cmp_graph --pretty=tformat:%s --color=never --date-order --pretty=tformat:%s after-initial octopus-merge <<-\EOF
283247
* after-initial
284248
| *---. octopus-merge
285249
| |\ \ \
@@ -296,14 +260,11 @@ test_expect_success 'log --graph with unrelated commit and octopus tip, no color
296260
|/
297261
* initial
298262
EOF
299-
git log --color=never --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.raw &&
300-
sed "s/ *\$//" actual.raw >actual &&
301-
test_cmp expect.uncolored actual
302263
'
303264

304265
test_expect_success 'log --graph with unrelated commit and octopus tip with colors' '
305266
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
306-
cat >expect.colors <<-\EOF &&
267+
test_cmp_colored_graph --pretty=tformat:%s --date-order after-initial octopus-merge <<-\EOF
307268
* after-initial
308269
<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
309270
<RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
@@ -320,13 +281,10 @@ test_expect_success 'log --graph with unrelated commit and octopus tip with colo
320281
<RED>|<RESET><RED>/<RESET>
321282
* initial
322283
EOF
323-
git log --color=always --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.colors.raw &&
324-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
325-
test_cmp expect.colors actual.colors
326284
'
327285

328286
test_expect_success 'log --graph with unrelated commit and octopus child, no color' '
329-
cat >expect.uncolored <<-\EOF &&
287+
test_cmp_graph --pretty=tformat:%s --color=never --date-order after-initial after-merge <<-\EOF
330288
* after-initial
331289
| * after-merge
332290
| *---. octopus-merge
@@ -344,14 +302,11 @@ test_expect_success 'log --graph with unrelated commit and octopus child, no col
344302
|/
345303
* initial
346304
EOF
347-
git log --color=never --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.raw &&
348-
sed "s/ *\$//" actual.raw >actual &&
349-
test_cmp expect.uncolored actual
350305
'
351306

352307
test_expect_success 'log --graph with unrelated commit and octopus child with colors' '
353308
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
354-
cat >expect.colors <<-\EOF &&
309+
test_cmp_colored_graph --pretty=tformat:%s --date-order after-initial after-merge <<-\EOF
355310
* after-initial
356311
<RED>|<RESET> * after-merge
357312
<RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
@@ -369,9 +324,6 @@ test_expect_success 'log --graph with unrelated commit and octopus child with co
369324
<RED>|<RESET><RED>/<RESET>
370325
* initial
371326
EOF
372-
git log --color=always --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.colors.raw &&
373-
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
374-
test_cmp expect.colors actual.colors
375327
'
376328

377329
test_done

0 commit comments

Comments
 (0)