summaryrefslogtreecommitdiff
path: root/t/t4214-log-graph-octopus.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4214-log-graph-octopus.sh')
-rwxr-xr-xt/t4214-log-graph-octopus.sh82
1 files changed, 26 insertions, 56 deletions
diff --git a/t/t4214-log-graph-octopus.sh b/t/t4214-log-graph-octopus.sh
index 40d27db674..a080325098 100755
--- a/t/t4214-log-graph-octopus.sh
+++ b/t/t4214-log-graph-octopus.sh
@@ -3,6 +3,16 @@
test_description='git log --graph of skewed left octopus merge.'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-log-graph.sh
+
+test_cmp_graph () {
+ cat >expect &&
+ lib_test_cmp_graph --color=never --date-order --format=%s "$@"
+}
+
+test_cmp_colored_graph () {
+ lib_test_cmp_colored_graph --date-order --format=%s "$@"
+}
test_expect_success 'set up merge history' '
test_commit initial &&
@@ -24,7 +34,7 @@ test_expect_success 'set up merge history' '
'
test_expect_success 'log --graph with tricky octopus merge, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph left octopus-merge <<-\EOF
* left
| *-. octopus-merge
|/|\ \
@@ -37,9 +47,6 @@ test_expect_success 'log --graph with tricky octopus merge, no color' '
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s left octopus-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with tricky octopus merge with colors' '
@@ -57,16 +64,14 @@ test_expect_success 'log --graph with tricky octopus merge with colors' '
<MAGENTA>|<RESET><MAGENTA>/<RESET>
* initial
EOF
- git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph left octopus-merge
'
# Repeat the previous two tests with "normal" octopus merge (i.e.,
# without the first parent skewing to the "left" branch column).
test_expect_success 'log --graph with normal octopus merge, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph octopus-merge <<-\EOF
*---. octopus-merge
|\ \ \
| | | * 4
@@ -78,9 +83,6 @@ test_expect_success 'log --graph with normal octopus merge, no color' '
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s octopus-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with normal octopus merge with colors' '
@@ -97,13 +99,11 @@ test_expect_success 'log --graph with normal octopus merge with colors' '
* initial
EOF
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
- git log --color=always --graph --date-order --pretty=tformat:%s octopus-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph octopus-merge
'
test_expect_success 'log --graph with normal octopus merge and child, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph after-merge <<-\EOF
* after-merge
*---. octopus-merge
|\ \ \
@@ -116,9 +116,6 @@ test_expect_success 'log --graph with normal octopus merge and child, no color'
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s after-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with normal octopus and child merge with colors' '
@@ -136,13 +133,11 @@ test_expect_success 'log --graph with normal octopus and child merge with colors
* initial
EOF
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
- git log --color=always --graph --date-order --pretty=tformat:%s after-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph after-merge
'
test_expect_success 'log --graph with tricky octopus merge and its child, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph left after-merge <<-\EOF
* left
| * after-merge
| *-. octopus-merge
@@ -156,9 +151,6 @@ test_expect_success 'log --graph with tricky octopus merge and its child, no col
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s left after-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with tricky octopus merge and its child with colors' '
@@ -177,13 +169,11 @@ test_expect_success 'log --graph with tricky octopus merge and its child with co
<CYAN>|<RESET><CYAN>/<RESET>
* initial
EOF
- git log --color=always --graph --date-order --pretty=tformat:%s left after-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph left after-merge
'
test_expect_success 'log --graph with crossover in octopus merge, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph after-4 octopus-merge <<-\EOF
* after-4
| *---. octopus-merge
| |\ \ \
@@ -200,9 +190,6 @@ test_expect_success 'log --graph with crossover in octopus merge, no color' '
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with crossover in octopus merge with colors' '
@@ -224,13 +211,11 @@ test_expect_success 'log --graph with crossover in octopus merge with colors' '
<MAGENTA>|<RESET><MAGENTA>/<RESET>
* initial
EOF
- git log --color=always --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph after-4 octopus-merge
'
test_expect_success 'log --graph with crossover in octopus merge and its child, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph after-4 after-merge <<-\EOF
* after-4
| * after-merge
| *---. octopus-merge
@@ -248,9 +233,6 @@ test_expect_success 'log --graph with crossover in octopus merge and its child,
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with crossover in octopus merge and its child with colors' '
@@ -273,13 +255,11 @@ test_expect_success 'log --graph with crossover in octopus merge and its child w
<CYAN>|<RESET><CYAN>/<RESET>
* initial
EOF
- git log --color=always --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph after-4 after-merge
'
test_expect_success 'log --graph with unrelated commit and octopus tip, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph after-initial octopus-merge <<-\EOF
* after-initial
| *---. octopus-merge
| |\ \ \
@@ -296,9 +276,6 @@ test_expect_success 'log --graph with unrelated commit and octopus tip, no color
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with unrelated commit and octopus tip with colors' '
@@ -320,13 +297,11 @@ test_expect_success 'log --graph with unrelated commit and octopus tip with colo
<RED>|<RESET><RED>/<RESET>
* initial
EOF
- git log --color=always --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph after-initial octopus-merge
'
test_expect_success 'log --graph with unrelated commit and octopus child, no color' '
- cat >expect.uncolored <<-\EOF &&
+ test_cmp_graph after-initial after-merge <<-\EOF
* after-initial
| * after-merge
| *---. octopus-merge
@@ -344,9 +319,6 @@ test_expect_success 'log --graph with unrelated commit and octopus child, no col
|/
* initial
EOF
- git log --color=never --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.raw &&
- sed "s/ *\$//" actual.raw >actual &&
- test_cmp expect.uncolored actual
'
test_expect_success 'log --graph with unrelated commit and octopus child with colors' '
@@ -369,9 +341,7 @@ test_expect_success 'log --graph with unrelated commit and octopus child with co
<RED>|<RESET><RED>/<RESET>
* initial
EOF
- git log --color=always --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.colors.raw &&
- test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
- test_cmp expect.colors actual.colors
+ test_cmp_colored_graph after-initial after-merge
'
test_done