From: Sergey Organov Date: Mon, 21 Dec 2020 20:07:08 GMT Subject: Re: [PATCH v3 25/32] diff-merges: let new options enable diff without -p Message-ID: <87sg7yrkib.fsf@osv.gnss.ru> In-Reply-To: <5fe0ec103ad4f_e6ff208f5@natae.notmuch> Felipe Contreras writes: > Sergey Organov wrote: >> diff --git a/log-tree.c b/log-tree.c >> index f9385b1dae6f..9f50a81e537e 100644 >> --- a/log-tree.c >> +++ b/log-tree.c >> @@ -899,15 +899,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); > > FWIW this logic does make sense to me. Thanks for reviewing! -- Sergey