mirror of
https://github.com/git/git
synced 2024-08-23 18:00:25 +00:00
t4214: demonstrate octopus graph coloring failure
The graph coloring logic for octopus merges currently has a bug. This can be seen git.git with74c7cfa875
(Merge of http://members.cox.net/junkio/git-jc.git, 2005-05-05), whose second child is211232bae6
(Octopus merge of the following five patches., 2005-05-05). If one runs git log --graph74c7cfa875
one can see that the octopus merge is colored incorrectly. In particular, the horizontal dashes are off by one color. Each horizontal dash should be the color of the line to their bottom-right. Instead, they are currently the color of the line to their bottom. Demonstrate this breakage with a few sets of test cases. These test cases should show not only simple cases of the bug occuring but trickier situations that may not be handled properly in any attempt to fix the bug. While we're at it, include a passing test case as a canary in case an attempt to fix the bug breaks existing operation. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
25eb905e14
commit
11c21f22de
|
@ -14,8 +14,13 @@ test_expect_success 'set up merge history' '
|
|||
done &&
|
||||
git checkout 1 -b merge &&
|
||||
test_merge octopus-merge 1 2 3 4 &&
|
||||
test_commit after-merge &&
|
||||
git checkout 1 -b L &&
|
||||
test_commit left
|
||||
test_commit left &&
|
||||
git checkout 4 -b crossover &&
|
||||
test_commit after-4 &&
|
||||
git checkout initial -b more-L &&
|
||||
test_commit after-initial
|
||||
'
|
||||
|
||||
test_expect_success 'log --graph with tricky octopus merge, no color' '
|
||||
|
@ -98,4 +103,279 @@ test_expect_success 'log --graph with normal octopus merge with colors' '
|
|||
test_decode_color <actual.colors.raw | sed "s/ *\$//" >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 &&
|
||||
* after-merge
|
||||
*---. octopus-merge
|
||||
|\ \ \
|
||||
| | | * 4
|
||||
| | * | 3
|
||||
| | |/
|
||||
| * | 2
|
||||
| |/
|
||||
* | 1
|
||||
|/
|
||||
* 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_failure 'log --graph with normal octopus and child merge with colors' '
|
||||
cat >expect.colors <<-\EOF &&
|
||||
* after-merge
|
||||
*<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
|
||||
<GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
|
||||
<GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
|
||||
<GREEN>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
|
||||
<GREEN>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
|
||||
<GREEN>|<RESET> * <MAGENTA>|<RESET> 2
|
||||
<GREEN>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
|
||||
* <MAGENTA>|<RESET> 1
|
||||
<MAGENTA>|<RESET><MAGENTA>/<RESET>
|
||||
* 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_expect_success 'log --graph with tricky octopus merge and its child, no color' '
|
||||
cat >expect.uncolored <<-\EOF &&
|
||||
* left
|
||||
| * after-merge
|
||||
| *---. octopus-merge
|
||||
| |\ \ \
|
||||
|/ / / /
|
||||
| | | * 4
|
||||
| | * | 3
|
||||
| | |/
|
||||
| * | 2
|
||||
| |/
|
||||
* | 1
|
||||
|/
|
||||
* 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_failure '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 &&
|
||||
* left
|
||||
<RED>|<RESET> * after-merge
|
||||
<RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
|
||||
<RED>|<RESET> <RED>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET>
|
||||
<RED>|<RESET><RED>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET> <CYAN>/<RESET>
|
||||
<RED>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
|
||||
<RED>|<RESET> <BLUE>|<RESET> * <CYAN>|<RESET> 3
|
||||
<RED>|<RESET> <BLUE>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
|
||||
<RED>|<RESET> * <CYAN>|<RESET> 2
|
||||
<RED>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
|
||||
* <CYAN>|<RESET> 1
|
||||
<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_expect_success 'log --graph with crossover in octopus merge, no color' '
|
||||
cat >expect.uncolored <<-\EOF &&
|
||||
* after-4
|
||||
| *---. octopus-merge
|
||||
| |\ \ \
|
||||
| |_|_|/
|
||||
|/| | |
|
||||
* | | | 4
|
||||
| | | * 3
|
||||
| |_|/
|
||||
|/| |
|
||||
| | * 2
|
||||
| |/
|
||||
|/|
|
||||
| * 1
|
||||
|/
|
||||
* 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_failure 'log --graph with crossover in octopus merge with colors' '
|
||||
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
|
||||
cat >expect.colors <<-\EOF &&
|
||||
* after-4
|
||||
<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
|
||||
<RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <RED>\<RESET>
|
||||
<RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
|
||||
* <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> 4
|
||||
<MAGENTA>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
|
||||
<MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>_<RESET><YELLOW>|<RESET><MAGENTA>/<RESET>
|
||||
<MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
|
||||
<MAGENTA>|<RESET> <GREEN>|<RESET> * 2
|
||||
<MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>/<RESET>
|
||||
<MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET>
|
||||
<MAGENTA>|<RESET> * 1
|
||||
<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_expect_success 'log --graph with crossover in octopus merge and its child, no color' '
|
||||
cat >expect.uncolored <<-\EOF &&
|
||||
* after-4
|
||||
| * after-merge
|
||||
| *---. octopus-merge
|
||||
| |\ \ \
|
||||
| |_|_|/
|
||||
|/| | |
|
||||
* | | | 4
|
||||
| | | * 3
|
||||
| |_|/
|
||||
|/| |
|
||||
| | * 2
|
||||
| |/
|
||||
|/|
|
||||
| * 1
|
||||
|/
|
||||
* 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_failure '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 &&
|
||||
* after-4
|
||||
<RED>|<RESET> * after-merge
|
||||
<RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
|
||||
<RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <RED>\<RESET>
|
||||
<RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
|
||||
* <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> 4
|
||||
<CYAN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
|
||||
<CYAN>|<RESET> <YELLOW>|<RESET><CYAN>_<RESET><BLUE>|<RESET><CYAN>/<RESET>
|
||||
<CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
|
||||
<CYAN>|<RESET> <YELLOW>|<RESET> * 2
|
||||
<CYAN>|<RESET> <YELLOW>|<RESET><CYAN>/<RESET>
|
||||
<CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET>
|
||||
<CYAN>|<RESET> * 1
|
||||
<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_expect_success 'log --graph with unrelated commit and octopus tip, no color' '
|
||||
cat >expect.uncolored <<-\EOF &&
|
||||
* after-initial
|
||||
| *---. octopus-merge
|
||||
| |\ \ \
|
||||
| | | | * 4
|
||||
| |_|_|/
|
||||
|/| | |
|
||||
| | | * 3
|
||||
| |_|/
|
||||
|/| |
|
||||
| | * 2
|
||||
| |/
|
||||
|/|
|
||||
| * 1
|
||||
|/
|
||||
* 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 &&
|
||||
* after-initial
|
||||
<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
|
||||
<RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
|
||||
<RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
|
||||
<RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
|
||||
<RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
|
||||
<RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
|
||||
<RED>|<RESET> <GREEN>|<RESET> * 2
|
||||
<RED>|<RESET> <GREEN>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><GREEN>|<RESET>
|
||||
<RED>|<RESET> * 1
|
||||
<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_expect_success 'log --graph with unrelated commit and octopus child, no color' '
|
||||
cat >expect.uncolored <<-\EOF &&
|
||||
* after-initial
|
||||
| * after-merge
|
||||
| *---. octopus-merge
|
||||
| |\ \ \
|
||||
| | | | * 4
|
||||
| |_|_|/
|
||||
|/| | |
|
||||
| | | * 3
|
||||
| |_|/
|
||||
|/| |
|
||||
| | * 2
|
||||
| |/
|
||||
|/|
|
||||
| * 1
|
||||
|/
|
||||
* 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_failure 'log --graph with unrelated commit and octopus child with colors' '
|
||||
test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
|
||||
cat >expect.colors <<-\EOF &&
|
||||
* after-initial
|
||||
<RED>|<RESET> * after-merge
|
||||
<RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
|
||||
<RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET>
|
||||
<RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
|
||||
<RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
|
||||
<RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
|
||||
<RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
|
||||
<RED>|<RESET> <YELLOW>|<RESET> * 2
|
||||
<RED>|<RESET> <YELLOW>|<RESET><RED>/<RESET>
|
||||
<RED>|<RESET><RED>/<RESET><YELLOW>|<RESET>
|
||||
<RED>|<RESET> * 1
|
||||
<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_done
|
||||
|
|
Loading…
Reference in a new issue