]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4214-log-graph-octopus.sh
t4214: use test_merge
[thirdparty/git.git] / t / t4214-log-graph-octopus.sh
CommitLineData
04005834
NP
1#!/bin/sh
2
3test_description='git log --graph of skewed left octopus merge.'
4
5. ./test-lib.sh
6
7test_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
19 |/
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 &&
a7a5590c 44 test_merge octopus-merge 1 2 3 4 &&
04005834
NP
45 git checkout 1 -b L &&
46 test_commit left
47'
48
49test_expect_success 'log --graph with tricky octopus merge with colors' '
50 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
51 git log --color=always --graph --date-order --pretty=tformat:%s --all >actual.colors.raw &&
52 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
53 test_cmp expect.colors actual.colors
54'
55
56test_expect_success 'log --graph with tricky octopus merge, no color' '
57 git log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw &&
58 sed "s/ *\$//" actual.raw >actual &&
59 test_cmp expect.uncolored actual
60'
61
62# Repeat the previous two tests with "normal" octopus merge (i.e.,
63# without the first parent skewing to the "left" branch column).
64
65test_expect_success 'log --graph with normal octopus merge, no color' '
66 cat >expect.uncolored <<-\EOF &&
67 *---. octopus-merge
68 |\ \ \
69 | | | * 4
70 | | * | 3
71 | | |/
72 | * | 2
73 | |/
74 * | 1
75 |/
76 * initial
77 EOF
78 git log --color=never --graph --date-order --pretty=tformat:%s merge >actual.raw &&
79 sed "s/ *\$//" actual.raw >actual &&
80 test_cmp expect.uncolored actual
81'
82
83test_expect_success 'log --graph with normal octopus merge with colors' '
84 cat >expect.colors <<-\EOF &&
85 *<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET> octopus-merge
86 <RED>|<RESET><GREEN>\<RESET> <YELLOW>\<RESET> <BLUE>\<RESET>
87 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4
88 <RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3
89 <RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
90 <RED>|<RESET> * <BLUE>|<RESET> 2
91 <RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
92 * <BLUE>|<RESET> 1
93 <BLUE>|<RESET><BLUE>/<RESET>
94 * initial
95 EOF
96 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
97 git log --color=always --graph --date-order --pretty=tformat:%s merge >actual.colors.raw &&
98 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
99 test_cmp expect.colors actual.colors
100'
101test_done