Merge branch 'md/list-lazy-objects-fix'
[git.git] / t / t4214-log-graph-octopus.sh
blobdab96c89aa8aa5399fe70da118a0437572e90526
1 #!/bin/sh
3 test_description='git log --graph of skewed left octopus merge.'
5 . ./test-lib.sh
7 test_expect_success 'set up merge history' '
8 cat >expect.uncolored <<-\EOF &&
9 * left
10 | *---. octopus-merge
11 | |\ \ \
12 |/ / / /
13 | | | * 4
14 | | * | 3
15 | | |/
16 | * | 2
17 | |/
18 * | 1
20 * initial
21 EOF
22 cat >expect.colors <<-\EOF &&
23 * left
24 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
25 <RED>|<RESET> <RED>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
26 <RED>|<RESET><RED>/<RESET> <YELLOW>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET>
27 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
28 <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
29 <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
30 <RED>|<RESET> * <MAGENTA>|<RESET> 2
31 <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
32 * <MAGENTA>|<RESET> 1
33 <MAGENTA>|<RESET><MAGENTA>/<RESET>
34 * initial
35 EOF
36 test_commit initial &&
37 for i in 1 2 3 4 ; do
38 git checkout master -b $i || return $?
39 # Make tag name different from branch name, to avoid
40 # ambiguity error when calling checkout.
41 test_commit $i $i $i tag$i || return $?
42 done &&
43 git checkout 1 -b merge &&
44 test_tick &&
45 git merge -m octopus-merge 1 2 3 4 &&
46 git checkout 1 -b L &&
47 test_commit left
50 test_expect_success 'log --graph with tricky octopus merge with colors' '
51 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
52 git log --color=always --graph --date-order --pretty=tformat:%s --all >actual.colors.raw &&
53 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
54 test_cmp expect.colors actual.colors
57 test_expect_success 'log --graph with tricky octopus merge, no color' '
58 git log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw &&
59 sed "s/ *\$//" actual.raw >actual &&
60 test_cmp expect.uncolored actual
63 # Repeat the previous two tests with "normal" octopus merge (i.e.,
64 # without the first parent skewing to the "left" branch column).
66 test_expect_success 'log --graph with normal octopus merge, no color' '
67 cat >expect.uncolored <<-\EOF &&
68 *---. octopus-merge
69 |\ \ \
70 | | | * 4
71 | | * | 3
72 | | |/
73 | * | 2
74 | |/
75 * | 1
77 * initial
78 EOF
79 git log --color=never --graph --date-order --pretty=tformat:%s merge >actual.raw &&
80 sed "s/ *\$//" actual.raw >actual &&
81 test_cmp expect.uncolored actual
84 test_expect_success 'log --graph with normal octopus merge with colors' '
85 cat >expect.colors <<-\EOF &&
86 *<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET> octopus-merge
87 <RED>|<RESET><GREEN>\<RESET> <YELLOW>\<RESET> <BLUE>\<RESET>
88 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4
89 <RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3
90 <RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
91 <RED>|<RESET> * <BLUE>|<RESET> 2
92 <RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
93 * <BLUE>|<RESET> 1
94 <BLUE>|<RESET><BLUE>/<RESET>
95 * initial
96 EOF
97 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
98 git log --color=always --graph --date-order --pretty=tformat:%s merge >actual.colors.raw &&
99 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
100 test_cmp expect.colors actual.colors
102 test_done