diff options
Diffstat (limited to 'log-tree.c')
-rw-r--r-- | log-tree.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/log-tree.c b/log-tree.c index fd0dde97ec..e7dab99950 100644 --- a/log-tree.c +++ b/log-tree.c @@ -808,6 +808,11 @@ void show_log(struct rev_info *opt) if (cmit_fmt_is_mail(ctx.fmt) && opt->rdiff1) { struct diff_queue_struct dq; struct diff_options opts; + struct range_diff_options range_diff_opts = { + .creation_factor = opt->creation_factor, + .dual_color = 1, + .diffopt = &opts + }; memcpy(&dq, &diff_queued_diff, sizeof(diff_queued_diff)); DIFF_QUEUE_CLEAR(&diff_queued_diff); @@ -822,8 +827,7 @@ void show_log(struct rev_info *opt) opts.file = opt->diffopt.file; opts.use_color = opt->diffopt.use_color; diff_setup_done(&opts); - show_range_diff(opt->rdiff1, opt->rdiff2, - opt->creation_factor, 1, &opts, NULL); + show_range_diff(opt->rdiff1, opt->rdiff2, &range_diff_opts); memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff)); } @@ -899,15 +903,21 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log int showed_log; struct commit_list *parents; struct object_id *oid; + int is_merge; + int all_need_diff = opt->diff || opt->diffopt.flags.exit_with_status; - if (!opt->diff && !opt->diffopt.flags.exit_with_status) + if (!all_need_diff && !opt->merges_need_diff) return 0; parse_commit_or_die(commit); oid = get_commit_tree_oid(commit); - /* Root commit? */ parents = get_saved_parents(opt, commit); + is_merge = parents && parents->next; + if (!is_merge && !all_need_diff) + return 0; + + /* Root commit? */ if (!parents) { if (opt->show_root_diff) { diff_root_tree_oid(oid, "", &opt->diffopt); @@ -916,16 +926,16 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log return !opt->loginfo; } - /* More than one parent? */ - if (parents->next) { - if (opt->ignore_merges) - return 0; - else if (opt->combine_merges) + if (is_merge) { + if (opt->combine_merges) return do_diff_combined(opt, commit); - else if (!opt->first_parent_only) { - /* If we show multiple diffs, show the parent info */ - log->parent = parents->item; - } + if (opt->separate_merges) { + if (!opt->first_parent_merges) { + /* Show parent info for multiple diffs */ + log->parent = parents->item; + } + } else + return 0; } showed_log = 0; @@ -941,7 +951,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log /* Set up the log info for the next parent, if any.. */ parents = parents->next; - if (!parents || opt->first_parent_only) + if (!parents || opt->first_parent_merges) break; log->parent = parents->item; opt->loginfo = log; |