git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] A part of an edge from an octopus merge gets colored, even with --color=never

From
Noam Postavsky <npostavs@users.sourceforge.net>
Date
Jun 30, 2018, 12:47 UTC
Message-ID
<CAM-tV-8sbbht7NUwf87-gq=+P=LNPyiEcv3zL+1BxfXK+ktmVA@mail.gmail.com>
In-Reply-To
<20180625162308.GA13719@sigill.intra.peff.net>
On 25 June 2018 at 12:23, Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
> 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@users.sourceforge.net>
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@users.sourceforge.net>
---
 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
Previous: Jeff KingNext: Noam Postavsky
Message 9 of 22 in “[BUG] A part of an edge from an octopus merge gets colored, even with --color=never”
  1. Noam PostavskyMay 15, 2016
  2. Johannes SixtMay 17, 2016
  3. Jeff KingMay 17, 2016
  4. Jeff KingMay 17, 2016
  5. Jeff KingMay 17, 2016
  6. Noam PostavskyMay 20, 2016
  7. Noam PostavskyJun 23, 2018
  8. Jeff KingJun 25, 2018
  9. Noam PostavskyJun 30, 2018
  10. Noam PostavskyAug 6, 2018
  11. Jeff KingAug 6, 2018
  12. Jeff KingAug 6, 2018
  13. Noam PostavskySep 2, 2018
  14. Jeff KingSep 8, 2018
  15. Noam PostavskySep 25, 2018
  16. Noam PostavskyOct 3, 2018
  17. Jeff KingOct 3, 2018
  18. Noam PostavskyOct 3, 2018
  19. Jeff KingOct 9, 2018
  20. Noam PostavskyOct 10, 2018
  21. Johannes SixtMay 17, 2016
  22. Jeff KingMay 17, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.