2020-01-12 00:36:56 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='git log --graph of skewed left octopus merge.'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success 'set up merge history' '
|
2020-05-26 01:06:52 +02:00
|
|
|
cat >expect.uncolored <<-\EOF &&
|
2020-01-12 00:36:56 +01:00
|
|
|
* left
|
2020-05-26 01:06:52 +02:00
|
|
|
| *---. octopus-merge
|
|
|
|
| |\ \ \
|
|
|
|
|/ / / /
|
2020-01-12 00:36:56 +01:00
|
|
|
| | | * 4
|
|
|
|
| | * | 3
|
|
|
|
| | |/
|
2020-05-26 01:06:52 +02:00
|
|
|
| * | 2
|
2020-01-12 00:36:56 +01:00
|
|
|
| |/
|
2020-05-26 01:06:52 +02:00
|
|
|
* | 1
|
2020-01-12 00:36:56 +01:00
|
|
|
|/
|
|
|
|
* initial
|
|
|
|
EOF
|
|
|
|
cat >expect.colors <<-\EOF &&
|
|
|
|
* left
|
2020-05-26 01:06:52 +02:00
|
|
|
<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
|
|
|
|
<RED>|<RESET> <RED>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
|
|
|
|
<RED>|<RESET><RED>/<RESET> <YELLOW>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET>
|
2020-01-12 00:36:56 +01:00
|
|
|
<RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
|
|
|
|
<RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
|
|
|
|
<RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
|
2020-05-26 01:06:52 +02:00
|
|
|
<RED>|<RESET> * <MAGENTA>|<RESET> 2
|
2020-01-12 00:36:56 +01:00
|
|
|
<RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
|
2020-05-26 01:06:52 +02:00
|
|
|
* <MAGENTA>|<RESET> 1
|
2020-01-12 00:36:56 +01:00
|
|
|
<MAGENTA>|<RESET><MAGENTA>/<RESET>
|
|
|
|
* initial
|
|
|
|
EOF
|
2020-05-26 01:06:52 +02:00
|
|
|
test_commit initial &&
|
|
|
|
for i in 1 2 3 4 ; do
|
|
|
|
git checkout master -b $i || return $?
|
|
|
|
# Make tag name different from branch name, to avoid
|
|
|
|
# ambiguity error when calling checkout.
|
|
|
|
test_commit $i $i $i tag$i || return $?
|
|
|
|
done &&
|
|
|
|
git checkout 1 -b merge &&
|
|
|
|
test_tick &&
|
|
|
|
git merge -m octopus-merge 1 2 3 4 &&
|
|
|
|
git checkout 1 -b L &&
|
|
|
|
test_commit left
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'log --graph with tricky octopus merge with colors' '
|
|
|
|
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
|
|
|
|
git log --color=always --graph --date-order --pretty=tformat:%s --all >actual.colors.raw &&
|
|
|
|
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
|
|
|
|
test_cmp expect.colors actual.colors
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'log --graph with tricky octopus merge, no color' '
|
|
|
|
git log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw &&
|
|
|
|
sed "s/ *\$//" actual.raw >actual &&
|
|
|
|
test_cmp expect.uncolored actual
|
2020-01-12 00:36:56 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
# 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' '
|
2020-05-26 01:06:52 +02:00
|
|
|
cat >expect.uncolored <<-\EOF &&
|
2020-01-12 00:36:56 +01:00
|
|
|
*---. octopus-merge
|
|
|
|
|\ \ \
|
|
|
|
| | | * 4
|
|
|
|
| | * | 3
|
|
|
|
| | |/
|
2020-05-26 01:06:52 +02:00
|
|
|
| * | 2
|
2020-01-12 00:36:56 +01:00
|
|
|
| |/
|
2020-05-26 01:06:52 +02:00
|
|
|
* | 1
|
2020-01-12 00:36:56 +01:00
|
|
|
|/
|
|
|
|
* initial
|
|
|
|
EOF
|
2020-05-26 01:06:52 +02:00
|
|
|
git log --color=never --graph --date-order --pretty=tformat:%s merge >actual.raw &&
|
|
|
|
sed "s/ *\$//" actual.raw >actual &&
|
|
|
|
test_cmp expect.uncolored actual
|
2020-01-12 00:36:56 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'log --graph with normal octopus merge with colors' '
|
|
|
|
cat >expect.colors <<-\EOF &&
|
|
|
|
*<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET> octopus-merge
|
|
|
|
<RED>|<RESET><GREEN>\<RESET> <YELLOW>\<RESET> <BLUE>\<RESET>
|
|
|
|
<RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4
|
|
|
|
<RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3
|
|
|
|
<RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
|
2020-05-26 01:06:52 +02:00
|
|
|
<RED>|<RESET> * <BLUE>|<RESET> 2
|
2020-01-12 00:36:56 +01:00
|
|
|
<RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
|
2020-05-26 01:06:52 +02:00
|
|
|
* <BLUE>|<RESET> 1
|
2020-01-12 00:36:56 +01:00
|
|
|
<BLUE>|<RESET><BLUE>/<RESET>
|
|
|
|
* initial
|
|
|
|
EOF
|
|
|
|
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
|
2020-05-26 01:06:52 +02:00
|
|
|
git log --color=always --graph --date-order --pretty=tformat:%s merge >actual.colors.raw &&
|
|
|
|
test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
|
|
|
|
test_cmp expect.colors actual.colors
|
2020-01-12 00:36:56 +01:00
|
|
|
'
|
|
|
|
test_done
|