From 88d9d45d071379e81e585faa95e4f28414d7d973 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Wed, 10 Feb 2010 02:11:49 +0100 Subject: git log -p -m: document -m and honor --first-parent git log -p -m is used to show one merge entry per parent, with an appropriate diff; this can be useful when examining histories where full set of changes introduced by a merged branch is interesting, not only the conflicts. This patch properly documents the -m switch, which has so far been mentioned only as a fairly special diff-tree flag. It also makes the code show full patch entry only for the first parent when --first-parent is used. Thus: git log -p -m --first-parent will show the history from the "main branch perspective", while also including full diff of changes introduced by other merged in branches. Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- log-tree.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'log-tree.c') diff --git a/log-tree.c b/log-tree.c index 27afcf6972..d3ae969f60 100644 --- a/log-tree.c +++ b/log-tree.c @@ -514,6 +514,16 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log return 0; else if (opt->combine_merges) return do_diff_combined(opt, commit); + else if (opt->first_parent_only) { + /* + * Generate merge log entry only for the first + * parent, showing summary diff of the others + * we merged _in_. + */ + diff_tree_sha1(parents->item->object.sha1, sha1, "", &opt->diffopt); + log_tree_diff_flush(opt); + return !opt->loginfo; + } /* If we show individual diffs, show the parent info */ log->parent = parents->item; -- cgit v1.2.3