From: Abhishek Kumar Date: Sun, 16 Feb 2020 13:47:49 GMT Subject: [GSoC Patch 4/5] t4214: use lib-log-graph functions Message-ID: <20200216134750.18947-4-abhishekkumar8222@gmail.com> In-Reply-To: <20200216134750.18947-1-abhishekkumar8222@gmail.com> Helped-by: Johannes Schindelin Signed-off-by: Abhishek Kumar --- t/t4214-log-graph-octopus.sh | 86 ++++++++---------------------------- 1 file changed, 19 insertions(+), 67 deletions(-) diff --git a/t/t4214-log-graph-octopus.sh b/t/t4214-log-graph-octopus.sh index 40d27db674..e85cf07d2c 100755 --- a/t/t4214-log-graph-octopus.sh +++ b/t/t4214-log-graph-octopus.sh @@ -3,6 +3,7 @@ test_description='git log --graph of skewed left octopus merge.' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-log-graph.sh test_expect_success 'set up merge history' ' test_commit initial && @@ -24,7 +25,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 --pretty=tformat:%s --color=never --date-order left octopus-merge <<-\EOF * left | *-. octopus-merge |/|\ \ @@ -37,14 +38,11 @@ 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' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && + test_cmp_colored_graph --pretty=tformat:%s --date-order left octopus-merge <<-\EOF * left | *-. octopus-merge |/|\ \ @@ -57,16 +55,13 @@ test_expect_success 'log --graph with tricky octopus merge with colors' ' |/ * initial EOF - git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw && - test_decode_color actual.colors && - test_cmp expect.colors actual.colors ' # 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 --pretty=tformat:%s --color=never --date-order octopus-merge <<-\EOF *---. octopus-merge |\ \ \ | | | * 4 @@ -78,13 +73,11 @@ 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' ' - cat >expect.colors <<-\EOF && + test_config log.graphColors red,green,yellow,blue,magenta,cyan && + test_cmp_colored_graph --pretty=tformat:%s --date-order octopus-merge <<-\EOF *---. octopus-merge |\ \ \ | | | * 4 @@ -96,14 +89,10 @@ 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 && - test_cmp expect.colors actual.colors ' test_expect_success 'log --graph with normal octopus merge and child, no color' ' - cat >expect.uncolored <<-\EOF && + test_cmp_graph --pretty=tformat:%s --color=never --date-order after-merge <<-\EOF * after-merge *---. octopus-merge |\ \ \ @@ -116,13 +105,11 @@ 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' ' - cat >expect.colors <<-\EOF && + test_config log.graphColors red,green,yellow,blue,magenta,cyan && + test_cmp_colored_graph --pretty=tformat:%s --date-order after-merge <<-\EOF * after-merge *---. octopus-merge |\ \ \ @@ -135,14 +122,10 @@ 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 && - test_cmp expect.colors actual.colors ' test_expect_success 'log --graph with tricky octopus merge and its child, no color' ' - cat >expect.uncolored <<-\EOF && + test_cmp_graph --pretty=tformat:%s --color=never --date-order left after-merge <<-\EOF * left | * after-merge | *-. octopus-merge @@ -156,14 +139,10 @@ 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' ' - test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && + test_cmp_colored_graph --pretty=tformat:%s --date-order left after-merge <<-\EOF * left | * after-merge | *-. octopus-merge @@ -177,13 +156,10 @@ test_expect_success 'log --graph with tricky octopus merge and its child with co |/ * initial EOF - git log --color=always --graph --date-order --pretty=tformat:%s left after-merge >actual.colors.raw && - test_decode_color actual.colors && - test_cmp expect.colors actual.colors ' test_expect_success 'log --graph with crossover in octopus merge, no color' ' - cat >expect.uncolored <<-\EOF && + test_cmp_graph --pretty=tformat:%s --date-order after-4 octopus-merge <<-\EOF * after-4 | *---. octopus-merge | |\ \ \ @@ -200,14 +176,11 @@ 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' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && + test_cmp_colored_graph --pretty=tformat:%s --date-order after-4 octopus-merge <<-\EOF * after-4 | *---. octopus-merge | |\ \ \ @@ -224,13 +197,10 @@ test_expect_success 'log --graph with crossover in octopus merge with colors' ' |/ * initial EOF - git log --color=always --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.colors.raw && - test_decode_color actual.colors && - test_cmp expect.colors actual.colors ' test_expect_success 'log --graph with crossover in octopus merge and its child, no color' ' - cat >expect.uncolored <<-\EOF && + test_cmp_graph --pretty=tformat:%s --date-order after-4 after-merge <<-\EOF * after-4 | * after-merge | *---. octopus-merge @@ -248,14 +218,11 @@ 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' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && + test_cmp_colored_graph --pretty=tformat:%s --date-order after-4 after-merge <<-\EOF * after-4 | * after-merge | *---. octopus-merge @@ -273,13 +240,10 @@ test_expect_success 'log --graph with crossover in octopus merge and its child w |/ * initial EOF - git log --color=always --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.colors.raw && - test_decode_color actual.colors && - test_cmp expect.colors actual.colors ' test_expect_success 'log --graph with unrelated commit and octopus tip, no color' ' - cat >expect.uncolored <<-\EOF && + test_cmp_graph --pretty=tformat:%s --color=never --date-order --pretty=tformat:%s after-initial octopus-merge <<-\EOF * after-initial | *---. octopus-merge | |\ \ \ @@ -296,14 +260,11 @@ 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' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && + test_cmp_colored_graph --pretty=tformat:%s --date-order after-initial octopus-merge <<-\EOF * after-initial | *---. octopus-merge | |\ \ \ @@ -320,13 +281,10 @@ test_expect_success 'log --graph with unrelated commit and octopus tip with colo |/ * initial EOF - git log --color=always --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.colors.raw && - test_decode_color actual.colors && - test_cmp expect.colors actual.colors ' test_expect_success 'log --graph with unrelated commit and octopus child, no color' ' - cat >expect.uncolored <<-\EOF && + test_cmp_graph --pretty=tformat:%s --color=never --date-order after-initial after-merge <<-\EOF * after-initial | * after-merge | *---. octopus-merge @@ -344,14 +302,11 @@ 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' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && - cat >expect.colors <<-\EOF && + test_cmp_colored_graph --pretty=tformat:%s --date-order after-initial after-merge <<-\EOF * after-initial | * after-merge | *---. octopus-merge @@ -369,9 +324,6 @@ test_expect_success 'log --graph with unrelated commit and octopus child with co |/ * initial EOF - git log --color=always --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.colors.raw && - test_decode_color actual.colors && - test_cmp expect.colors actual.colors ' test_done -- 2.25.0