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

[PATCH] graph: Fix log's graph's colors when merging branches.

From
HNHemmo Nieminen <hemmo.nieminen@iki.fi>
Date
Oct 17, 2013, 06:52 UTC
Message-ID
<20131017064853.GA7419@duunidell>
>From bdbefc100ceba66a70f540dfe2b1b09b0869f7ab Mon Sep 17 00:00:00 2001
From: Hemmo Nieminen <hemmo.nieminen@iki.fi>
Date: Wed, 16 Oct 2013 11:28:50 +0300
Subject: [PATCH] graph: Fix log's graph's colors when merging branches.

The log's graph's colors were off sometimes when merging several branches. For example in the graph depicted below, the '-----.' part following the asterisk was colored with incorrect colors. This was caused by the fact that the leftmost branches, not part of the merge, were not taken into account when calculating the column numbers (colors).

  | |     Merge of http://members.cox.net/junkio/git-jc.git
  | |
  | *-----.   commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e
  | |\ \ \ \  Merge: fc54a9c 9e30dd7 c4b83e6 6602659 b28858b
  | | | | | | Author: Junio C Hamano <junkio@cox.net>
Signed-off-by: Hemmo Nieminen <hemmo.nieminen@iki.fi>
---
 graph.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/graph.c b/graph.c
index b24d04c..6404331 100644
--- a/graph.c
+++ b/graph.c
@@ -801,10 +801,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;
+		col_num = (i / 2) + dashless_commits + graph->commit_index;
 		strbuf_write_column(sb, &graph->new_columns[col_num], '-');
 	}
-	col_num = (i / 2) + dashless_commits;
+	col_num = (i / 2) + dashless_commits + graph->commit_index;
 	strbuf_write_column(sb, &graph->new_columns[col_num], '.');
 	return num_dashes + 1;
 }
-- 
1.8.4.1
Next: John Keeping
Message 1 of 3 in “graph: Fix log's graph's colors when merging branches.”
  1. graph: Fix log's graph's colors when merging branches.Hemmo Nieminen, Oct 17, 2013
  2. John KeepingOct 17, 2013
  3. Hemmo NieminenOct 17, 2013

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.