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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux