Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-01-31 01:17:08 +0300
committerJunio C Hamano <gitster@pobox.com>2020-01-31 01:17:08 +0300
commitd52adee7790352c96fa37558206e6db8866879d2 (patch)
treef8b1110bec01757b1ad7b351559cac71f7986cc0
parent690947449157c8fd6e84b25352f717d5f1fc6a51 (diff)
parentc958d3bd0a3781094db6fa8c45776785c98b6c98 (diff)
Merge branch 'ds/graph-horizontal-edges'
Rendering by "git log --graph" of ancestry lines leading to a merge commit were made suboptimal to waste vertical space a bit with a recent update, which has been corrected. * ds/graph-horizontal-edges: graph: fix collapse of multiple edges graph: add test to demonstrate horizontal line bug
-rw-r--r--graph.c10
-rwxr-xr-xt/t4215-log-skewed-merges.sh62
2 files changed, 70 insertions, 2 deletions
diff --git a/graph.c b/graph.c
index aaf97069bd..4fb25ad464 100644
--- a/graph.c
+++ b/graph.c
@@ -1233,8 +1233,14 @@ static void graph_output_collapsing_line(struct git_graph *graph, struct graph_l
* prevent any other edges from moving
* horizontally.
*/
- if (horizontal_edge == -1)
- horizontal_edge = i;
+ if (horizontal_edge == -1) {
+ int j;
+ horizontal_edge_target = target;
+ horizontal_edge = i - 1;
+
+ for (j = (target * 2) + 3; j < (i - 2); j += 2)
+ graph->mapping[j] = target;
+ }
}
}
diff --git a/t/t4215-log-skewed-merges.sh b/t/t4215-log-skewed-merges.sh
index 5661ed5881..1d0d3240ff 100755
--- a/t/t4215-log-skewed-merges.sh
+++ b/t/t4215-log-skewed-merges.sh
@@ -311,4 +311,66 @@ test_expect_success 'log --graph with multiple tips and colors' '
test_cmp expect.colors actual.colors
'
+test_expect_success '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