summaryrefslogtreecommitdiff
path: root/t/t4214-log-graph-octopus.sh
blob: 097151da3936b63a4fca71d3c065c4a1d6b7f596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh

test_description='git log --graph of skewed left octopus merge.'

. ./test-lib.sh

test_expect_success 'set up merge history' '
	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_merge octopus-merge 1 2 3 4 &&
	git checkout 1 -b L &&
	test_commit left
'

test_expect_success 'log --graph with tricky octopus merge, no color' '
	cat >expect.uncolored <<-\EOF &&
	* left
	| *---.   octopus-merge
	| |\ \ \
	|/ / / /
	| | | * 4
	| | * | 3
	| | |/
	| * | 2
	| |/
	* | 1
	|/
	* initial
	EOF
	git log --color=never --graph --date-order --pretty=tformat:%s left octopus-merge >actual.raw &&
	sed "s/ *\$//" actual.raw >actual &&
	test_cmp expect.uncolored actual
'

test_expect_success 'log --graph with tricky octopus merge with colors' '
	test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
	cat >expect.colors <<-\EOF &&
	* left
	<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>
	<RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
	<RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
	<RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
	<RED>|<RESET> * <MAGENTA>|<RESET> 2
	<RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
	* <MAGENTA>|<RESET> 1
	<MAGENTA>|<RESET><MAGENTA>/<RESET>
	* initial
	EOF
	git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
	test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
	test_cmp expect.colors actual.colors
'

# 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' '
	cat >expect.uncolored <<-\EOF &&
	*---.   octopus-merge
	|\ \ \
	| | | * 4
	| | * | 3
	| | |/
	| * | 2
	| |/
	* | 1
	|/
	* initial
	EOF
	git log --color=never --graph --date-order --pretty=tformat:%s octopus-merge >actual.raw &&
	sed "s/ *\$//" actual.raw >actual &&
	test_cmp expect.uncolored actual
'

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>
	<RED>|<RESET> * <BLUE>|<RESET> 2
	<RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
	* <BLUE>|<RESET> 1
	<BLUE>|<RESET><BLUE>/<RESET>
	* initial
	EOF
	test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
	git log --color=always --graph --date-order --pretty=tformat:%s octopus-merge >actual.colors.raw &&
	test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
	test_cmp expect.colors actual.colors
'
test_done