@@ -10,6 +10,10 @@ test_cmp_graph () {
1010 lib_test_cmp_graph --color=never --date-order --format=%s " $@ "
1111}
1212
13+ test_cmp_colored_graph () {
14+ lib_test_cmp_colored_graph --date-order --format=%s " $@ "
15+ }
16+
1317test_expect_success ' set up merge history' '
1418 test_commit initial &&
1519 for i in 1 2 3 4 ; do
@@ -60,9 +64,7 @@ test_expect_success 'log --graph with tricky octopus merge with colors' '
6064 <MAGENTA>|<RESET><MAGENTA>/<RESET>
6165 * initial
6266 EOF
63- git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
64- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
65- test_cmp expect.colors actual.colors
67+ test_cmp_colored_graph left octopus-merge
6668'
6769
6870# Repeat the previous two tests with "normal" octopus merge (i.e.,
@@ -97,9 +99,7 @@ test_expect_success 'log --graph with normal octopus merge with colors' '
9799 * initial
98100 EOF
99101 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
102+ test_cmp_colored_graph octopus-merge
103103'
104104
105105test_expect_success ' log --graph with normal octopus merge and child, no color' '
@@ -133,9 +133,7 @@ test_expect_success 'log --graph with normal octopus and child merge with colors
133133 * initial
134134 EOF
135135 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
136- git log --color=always --graph --date-order --pretty=tformat:%s after-merge >actual.colors.raw &&
137- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
138- test_cmp expect.colors actual.colors
136+ test_cmp_colored_graph after-merge
139137'
140138
141139test_expect_success ' log --graph with tricky octopus merge and its child, no color' '
@@ -171,9 +169,7 @@ test_expect_success 'log --graph with tricky octopus merge and its child with co
171169 <CYAN>|<RESET><CYAN>/<RESET>
172170 * initial
173171 EOF
174- git log --color=always --graph --date-order --pretty=tformat:%s left after-merge >actual.colors.raw &&
175- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
176- test_cmp expect.colors actual.colors
172+ test_cmp_colored_graph left after-merge
177173'
178174
179175test_expect_success ' log --graph with crossover in octopus merge, no color' '
@@ -215,9 +211,7 @@ test_expect_success 'log --graph with crossover in octopus merge with colors' '
215211 <MAGENTA>|<RESET><MAGENTA>/<RESET>
216212 * initial
217213 EOF
218- git log --color=always --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.colors.raw &&
219- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
220- test_cmp expect.colors actual.colors
214+ test_cmp_colored_graph after-4 octopus-merge
221215'
222216
223217test_expect_success ' log --graph with crossover in octopus merge and its child, no color' '
@@ -261,9 +255,7 @@ test_expect_success 'log --graph with crossover in octopus merge and its child w
261255 <CYAN>|<RESET><CYAN>/<RESET>
262256 * initial
263257 EOF
264- git log --color=always --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.colors.raw &&
265- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
266- test_cmp expect.colors actual.colors
258+ test_cmp_colored_graph after-4 after-merge
267259'
268260
269261test_expect_success ' log --graph with unrelated commit and octopus tip, no color' '
@@ -305,9 +297,7 @@ test_expect_success 'log --graph with unrelated commit and octopus tip with colo
305297 <RED>|<RESET><RED>/<RESET>
306298 * initial
307299 EOF
308- git log --color=always --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.colors.raw &&
309- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
310- test_cmp expect.colors actual.colors
300+ test_cmp_colored_graph after-initial octopus-merge
311301'
312302
313303test_expect_success ' log --graph with unrelated commit and octopus child, no color' '
@@ -351,9 +341,7 @@ test_expect_success 'log --graph with unrelated commit and octopus child with co
351341 <RED>|<RESET><RED>/<RESET>
352342 * initial
353343 EOF
354- git log --color=always --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.colors.raw &&
355- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
356- test_cmp expect.colors actual.colors
344+ test_cmp_colored_graph after-initial after-merge
357345'
358346
359347test_done
0 commit comments