]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4214-log-graph-octopus.sh
t4214: explicitly list tags in log
[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' '
63be8c8d
DL
8 test_commit initial &&
9 for i in 1 2 3 4 ; do
10 git checkout master -b $i || return $?
11 # Make tag name different from branch name, to avoid
12 # ambiguity error when calling checkout.
13 test_commit $i $i $i tag$i || return $?
14 done &&
15 git checkout 1 -b merge &&
16 test_merge octopus-merge 1 2 3 4 &&
17 git checkout 1 -b L &&
18 test_commit left
19'
20
21test_expect_success 'log --graph with tricky octopus merge, no color' '
04005834
NP
22 cat >expect.uncolored <<-\EOF &&
23 * left
24 | *---. octopus-merge
25 | |\ \ \
26 |/ / / /
27 | | | * 4
28 | | * | 3
29 | | |/
30 | * | 2
31 | |/
32 * | 1
33 |/
34 * initial
35 EOF
25eb905e 36 git log --color=never --graph --date-order --pretty=tformat:%s left octopus-merge >actual.raw &&
63be8c8d
DL
37 sed "s/ *\$//" actual.raw >actual &&
38 test_cmp expect.uncolored actual
39'
40
41test_expect_success 'log --graph with tricky octopus merge with colors' '
42 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
04005834
NP
43 cat >expect.colors <<-\EOF &&
44 * left
45 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
46 <RED>|<RESET> <RED>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
47 <RED>|<RESET><RED>/<RESET> <YELLOW>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET>
48 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
49 <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
50 <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
51 <RED>|<RESET> * <MAGENTA>|<RESET> 2
52 <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
53 * <MAGENTA>|<RESET> 1
54 <MAGENTA>|<RESET><MAGENTA>/<RESET>
55 * initial
56 EOF
25eb905e 57 git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
04005834
NP
58 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
59 test_cmp expect.colors actual.colors
60'
61
04005834
NP
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
25eb905e 78 git log --color=never --graph --date-order --pretty=tformat:%s octopus-merge >actual.raw &&
04005834
NP
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 &&
25eb905e 97 git log --color=always --graph --date-order --pretty=tformat:%s octopus-merge >actual.colors.raw &&
04005834
NP
98 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
99 test_cmp expect.colors actual.colors
100'
101test_done