Skip to content

Commit

Permalink
graph: add test to demonstrate horizontal line bug
Browse files Browse the repository at this point in the history
A previous test in t4215-log-skewed-merges.sh was added to demonstrate
exactly the topology of a reported failure in "git log --graph". While
investigating the fix, we realized that multiple edges that could
collapse with horizontal lines were not doing so.

Specifically, examine this section of the graph:

	| | | | | | *
	| |_|_|_|_|/|\
	|/| | | | |/ /
	| | | | |/| /
	| | | |/| |/
	| | |/| |/|
	| |/| |/| |
	| | |/| | |
	| | * | | |

Document this behavior with a test. This behavior is new, as the
behavior in v2.24.1 has the following output:

	| | | | | | *-.
	| | | | | | |\ \
	| |_|_|_|_|/ / /
	|/| | | | | / /
	| | |_|_|_|/ /
	| |/| | | | /
	| | | |_|_|/
	| | |/| | |
	| | * | | |

The behavior changed logically in 479db18 ("graph: smooth appearance
of collapsing edges on commit lines", 2019-10-15), but was actually
broken due to an assert() bug in 458152c ("graph: example of graph
output that can be simplified", 2019-10-15). A future change could
modify this behavior to do the following instead:

	| | | | | | *
	| |_|_|_|_|/|\
	|/| | | | |/ /
	| | |_|_|/| /
	| |/| | | |/
	| | | |_|/|
	| | |/| | |
	| | * | | |

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
derrickstolee authored and gitster committed Jan 15, 2020
1 parent d0654dc commit 8588932
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions t/t4215-log-skewed-merges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,66 @@ test_expect_success 'log --graph with multiple tips and colors' '
test_cmp expect.colors actual.colors
'

test_expect_failure 'log --graph with multiple tips' '
git checkout --orphan 7_1 &&
test_commit 7_A &&
test_commit 7_B &&
test_commit 7_C &&
git checkout -b 7_2 7_1~2 &&
test_commit 7_D &&
test_commit 7_E &&
git checkout -b 7_3 7_1~1 &&
test_commit 7_F &&
test_commit 7_G &&
git checkout -b 7_4 7_2~1 &&
test_commit 7_H &&
git checkout -b 7_5 7_1~2 &&
test_commit 7_I &&
git checkout -b 7_6 7_3~1 &&
test_commit 7_J &&
git checkout -b M_1 7_1 &&
git merge --no-ff 7_2 -m 7_M1 &&
git checkout -b M_3 7_3 &&
git merge --no-ff 7_4 -m 7_M2 &&
git checkout -b M_5 7_5 &&
git merge --no-ff 7_6 -m 7_M3 &&
git checkout -b M_7 7_1 &&
git merge --no-ff 7_2 7_3 -m 7_M4 &&
check_graph M_1 M_3 M_5 M_7 <<-\EOF
* 7_M1
|\
| | * 7_M2
| | |\
| | | * 7_H
| | | | * 7_M3
| | | | |\
| | | | | * 7_J
| | | | * | 7_I
| | | | | | * 7_M4
| |_|_|_|_|/|\
|/| | | | |/ /
| | |_|_|/| /
| |/| | | |/
| | | |_|/|
| | |/| | |
| | * | | | 7_G
| | | |_|/
| | |/| |
| | * | | 7_F
| * | | | 7_E
| | |/ /
| |/| |
| * | | 7_D
| | |/
| |/|
* | | 7_C
| |/
|/|
* | 7_B
|/
* 7_A
EOF
'

test_done

0 comments on commit 8588932

Please sign in to comment.