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

[PATCH] graph API: improve output for merge commits (option 1)

From
Adam Simpkins <adam@adamsimpkins.net>
Date
May 29, 2008, 09:03 UTC
Message-ID
<1212051825-32102-1-git-send-email-adam@adamsimpkins.net>
In-Reply-To
<20080529085752.GA31865@adamsimpkins.net>

This eliminates the extra space that sometimes appeared in branch lines to the right of 2-way merge commits. (It appeared when the branch line was displayed as '\' on the line just before the merge commit.)

For example,
| |\
| M  \
| |\  |
is now displayed as
| |\
| M \
| |\ \
Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
---
 graph.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/graph.c b/graph.c
index 26b8c52..c3babcb 100644
--- a/graph.c
+++ b/graph.c
@@ -625,10 +625,8 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
 			seen_this = 1;
 			graph_output_commit_char(graph, sb);
 
-			if (graph->num_parents < 2)
+			if (graph->num_parents < 3)
 				strbuf_addch(sb, ' ');
-			else if (graph->num_parents == 2)
-				strbuf_addstr(sb, "  ");
 			else {
 				int num_dashes =
 					((graph->num_parents - 2) * 2) - 1;
@@ -679,9 +677,7 @@ void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
 			strbuf_addch(sb, '|');
 			for (j = 0; j < graph->num_parents - 1; j++)
 				strbuf_addstr(sb, "\\ ");
-			if (graph->num_parents == 2)
-				strbuf_addch(sb, ' ');
-		} else if (seen_this && (graph->num_parents > 2)) {
+		} else if (seen_this) {
 			strbuf_addstr(sb, "\\ ");
 		} else {
 			strbuf_addstr(sb, "| ");
-- 
1.5.6.rc0.46.gd2b3.dirty
Previous: Adam SimpkinsNext: Adam Simpkins
Message 4 of 12 in “log --graph: extra space with --pretty=oneline”
  1. Teemu LikonenMay 28, 2008
  2. Wincent ColaiutaMay 28, 2008
  3. Adam SimpkinsMay 29, 2008
  4. graph API: improve output for merge commits (option 1)Adam Simpkins, May 29, 2008
  5. graph API: improve output for merge commits (option 2)Adam Simpkins, May 29, 2008
  6. Teemu LikonenMay 29, 2008
  7. 0/2 graph API: improve printing of mergesAdam Simpkins, Jun 1, 2008
  8. 1/2 graph API: improve display of merge commitsAdam Simpkins, Jun 1, 2008
  9. 2/2 graph API: avoid printing unnecessary padding before some octopus mergesAdam Simpkins, Jun 1, 2008
  10. Junio C HamanoJun 1, 2008
  11. Adam SimpkinsJun 2, 2008
  12. Junio C HamanoJun 2, 2008

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.