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

[PATCH 1/1] graph API: always print 'M' for merge commits

From
Adam Simpkins <adam@adamsimpkins.net>
Date
May 24, 2008, 20:52 UTC
Message-ID
<1211662321-28846-2-git-send-email-adam@adamsimpkins.net>
In-Reply-To
<1211662321-28846-1-git-send-email-adam@adamsimpkins.net>

The recent changes for handling uninteresting commits changed the behavior so that merge commits were displayed as 'M' only if they had multiple interesting parents.

This change reverts to the old behavior of displaying merges as 'M',
even if they have less than 2 parents displayed in the graph.
---
 graph.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/graph.c b/graph.c
index add7e44..ba9ede0 100644
--- a/graph.c
+++ b/graph.c
@@ -566,15 +566,17 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
 		if (col_commit == graph->commit) {
 			seen_this = 1;
 			/*
-			 * If the commit has more than 1 interesting
-			 * parent, print 'M' to indicate that it is a
-			 * merge.  Otherwise, print '*'.
+			 * If the commit is a merge, print 'M'.  Otherwise,
+			 * print '*'.
 			 *
-			 * Note that even if this is actually a merge
-			 * commit, we still print '*' if less than 2 of its
-			 * parents are interesting.
+			 * Note that we don't check graph->num_parents to
+			 * determine if the commit is a merge, since that
+			 * only tracks the number of "interesting" parents.
+			 * We want to print 'M' for merge commits even if
+			 * they have less than 2 interesting parents.
 			 */
-			if (graph->num_parents > 1)
+			if (graph->commit->parents != NULL &&
+			    graph->commit->parents->next != NULL)
 				strbuf_addch(sb, 'M');
 			else
 				strbuf_addch(sb, '*');
-- 
1.5.5.1.385.ge74ed
Previous: Adam SimpkinsNext: Adam Simpkins
Message 10 of 15 in “bug in "git log --graph" at the tail end?”
  1. Junio C HamanoMay 23, 2008
  2. Reece DunnMay 23, 2008
  3. Adam SimpkinsMay 24, 2008
  4. Junio C HamanoMay 24, 2008
  5. 0/2 fix "log --graph" issues with uninteresting parentsAdam Simpkins, May 24, 2008
  6. 1/2 graph API: fix graph mis-alignment after uninteresting commitsAdam Simpkins, May 24, 2008
  7. 2/2 graph API: don't print branch lines for uninteresting merge parentsAdam Simpkins, May 24, 2008
  8. Teemu LikonenMay 24, 2008
  9. 0/1 graph API: always print 'M' for merge commitsAdam Simpkins, May 24, 2008
  10. 1/1 graph API: always print 'M' for merge commitsAdam Simpkins, May 24, 2008
  11. Adam SimpkinsMay 24, 2008
  12. Junio C HamanoMay 25, 2008
  13. Teemu LikonenMay 25, 2008
  14. Adam SimpkinsMay 25, 2008
  15. Adam SimpkinsMay 24, 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.