Skip to contentSkip to conversation

log -m --graph does not work

BUG Jonathan Nieder 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

"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).

---
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(-)
revision.c +4 -0
index b1c1890..80e0cdb 100644
@@ -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;
 }
 
Signature · 1 line
1.7.2.3