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

[BUG] log -m --graph does not work

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 17, 2010, 20:29 UTC
Message-ID
<20101017202940.GA4534@burratino>

"git log" can pass "-m" to the internal diff-tree helper, with the handy result of multiple diffs for a merge, one against each parent. Unfortunately the graph pretty-printer doesn't know what to do with the second diff:

 $ git log -m --graph --oneline --shortstat origin/pu
 *   2ee46ba (from a13ef41) Merge branch 'jh/notes-merge' into pu
 |\
 | |  17 files changed, 3367 insertions(+), 143 deletions(-)
 | |
 | |
 | |
 | |
 | |
[...]

Error out to avoid getting the user's hopes up (unless -c, --cc, or --first-parent was supplied, since they work fine).

Noticed-by: Heikki Hokkanen <hoxu@users.sf.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
This patch breaks "git log --ancestry-path --graph -m -p" even in the
cases when it sort of works.  It's probably better to go straight to a
fix without this band-aid.
Hints?
 revision.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/revision.c b/revision.c
index b1c1890..80e0cdb 100644
--- a/revision.c
+++ b/revision.c
@@ -1681,6 +1681,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 	if (revs->reflog_info && revs->graph)
 		die("cannot combine --walk-reflogs with --graph");
 
+	if (!revs->ignore_merges && revs->graph &&
+	    !revs->combine_merges && !revs->first_parent_only)
+		die("cannot combine -m with --graph");
+
 	return left;
 }
 
-- 
1.7.2.3
Message 1 of 1 in “[BUG] log -m --graph does not work”
  1. Jonathan NiederOct 17, 2010

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.