On 25 June 2018 at 12:23, Jeff King <peff@xxxxxxxx> wrote: > These diagrams confused me for a minute, because I see two differences: > > 1. The first one has an extra apparently unrelated parallel branch on > the far left. > > 2. The first has the first-parent of the "*" merge commit immediately > join the branch. > > But if I understand correctly, we only care about the second property. Yeah, sorry about that, I just copied them from "natural" occurences and didn't remove all the non-relevant detail. > I don't remember much about our prior discussion, so let me try to talk > myself through the patch itself: I didn't remember all that much either, but I did know that I didn't have a very strong grasp on the code at the time. But your talk-through convinced me that I really have no clue what's going on :) I'm still having trouble getting a big picture understanding of how the graph struct relates the what gets drawn on screen, but through some poking around with the debugger + trial & error, I've arrived at a new patch which seems to work. It's also a lot simpler. I hope you can tell me if it makes sense. Also attached an updated test-multiway-merge.sh which allows adding more branches to test different sized merges more easily.
From ad40c5986264af1f5934b05082e16a3ce314caab Mon Sep 17 00:00:00 2001 From: Noam Postavsky <npostavs@xxxxxxxxxxxxxxxxxxxxx> Date: Sat, 23 Jun 2018 16:56:43 -0400 Subject: [PATCH v2] log: Fix coloring of certain octupus merge shapes The graph->new_columns index should depend on graph->commit_index. Signed-off-by: Noam Postavsky <npostavs@xxxxxxxxxxxxxxxxxxxxx> --- graph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graph.c b/graph.c index e1f6d3bdd..c78259020 100644 --- a/graph.c +++ b/graph.c @@ -857,10 +857,10 @@ static int graph_draw_octopus_merge(struct git_graph *graph, int num_dashes = ((graph->num_parents - dashless_commits) * 2) - 1; for (i = 0; i < num_dashes; i++) { - col_num = (i / 2) + dashless_commits + graph->commit_index; + col_num = (i / 2) + dashless_commits; strbuf_write_column(sb, &graph->new_columns[col_num], '-'); } - col_num = (i / 2) + dashless_commits + graph->commit_index; + col_num = (i / 2) + dashless_commits; strbuf_write_column(sb, &graph->new_columns[col_num], '.'); return num_dashes + 1; } -- 2.11.0
Attachment:
test-multiway-merge.sh
Description: Bourne shell script