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

[PATCH 0/2] Fix output of "git log --graph --boundary"

From
Adam Simpkins <adam@adamsimpkins.net>
Date
May 24, 2008, 23:02 UTC
Message-ID
<1211670125-10215-1-git-send-email-adam@adamsimpkins.net>

These two patches fix the graph output when --boundary is used. They apply on top of a merge of my recent fixes for handling uninteresting commits (since they use the new graph_is_interesting() function I added), and Dscho's "--graph --left-right" changes (since these changes also need the struct rev_info).

There were two small conflicts when merging Dscho's and my changes. I've including a merge diff below showing how I resolved them.

Adam Simpkins (2):
  Fix output of "git log --graph --boundary"
  get_revision(): honor the topo_order flag for boundary commits
 graph.c    |   87 ++++++++++++++++++++++++++++++++++++++++-------------------
 revision.c |   75 ++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 117 insertions(+), 45 deletions(-)

8acd45e94a0d42a0ceb164e294049104e0c0f663 diff --cc graph.c index ba9ede0,85a9ba0..479035d

--- a/graph.c
+++ b/graph.c
@@@ -55,11 -55,13 +55,15 @@@ struct git_graph 
  	 */
  	struct commit *commit;
  	/*
+ 	 * For the --left-right option.
+ 	 */
+ 	struct rev_info *revs;
+ 	/*
 -	 * The number of parents this commit has.
 -	 * (Stored so we don't have to walk over them each time we need
 -	 * this number)
 +	 * The number of interesting parents that this commit has.
 +	 *
 +	 * Note that this is not the same as the actual number of parents.
 +	 * This count excludes parents that won't be printed in the graph
 +	 * output, as determined by graph_is_interesting().
  	 */
  	int num_parents;
  	/*
@@@ -565,18 -545,14 +570,28 @@@ void graph_output_commit_line(struct gi
  
  		if (col_commit == graph->commit) {
  			seen_this = 1;
 +			/*
- 			 * If the commit is a merge, print 'M'.  Otherwise,
- 			 * print '*'.
++			 * If revs->left_right is set, print the '<' or '>'
++			 * depending on which side this commit came from.
++			 *
++			 * If revs->left_right is not set and the commit is
++			 * a merge, print 'M'.  Otherwise, print '*'.
 +			 *
 +			 * 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->commit->parents != NULL &&
- 			    graph->commit->parents->next != NULL)
+ 			if (graph->revs && graph->revs->left_right) {
+ 				if (graph->commit->object.flags
+ 						& SYMMETRIC_LEFT)
+ 					strbuf_addch(sb, '<');
+ 				else
+ 					strbuf_addch(sb, '>');
+ 			}
 -			else if (graph->num_parents > 1)
++			else if (graph->commit->parents != NULL &&
++				 graph->commit->parents->next != NULL)
  				strbuf_addch(sb, 'M');
  			else
  				strbuf_addch(sb, '*');
Next: Adam Simpkins
Message 1 of 4 in “Fix output of "git log --graph --boundary"”
  1. 0/2 Fix output of "git log --graph --boundary"Adam Simpkins, May 24, 2008
  2. 1/2 Fix output of "git log --graph --boundary"Adam Simpkins, May 24, 2008
  3. 2/2 get_revision(): honor the topo_order flag for boundary commitsAdam Simpkins, May 24, 2008
  4. Junio C HamanoMay 25, 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.