Subject: Re: Why doesn't `git log -m` imply `-p`?

From: Sergey Organov <[email-masked]>
Date: Mon, 10 May 2021 15:11:41 +0300

Alex Henrie <[email-masked]> writes:

> I read the following in `man git-log` today:
>
> --diff-merges=separate, --diff-merges=m, -m
>     This makes merge commits show the full diff with respect to each of
>     the parents. Separate log entry and diff is generated for each
>     parent.  -m doesn't produce any output without -p.
>
> --diff-merges=combined, --diff-merges=c, -c
>     With this option, diff output for a merge commit shows the
>     differences from each of the parents to the merge result
>     simultaneously instead of showing pairwise diff between a parent and
>     the result one at a time. Furthermore, it lists only files which
>     were modified from all parents.  -c implies -p.
>
> --diff-merges=dense-combined, --diff-merges=cc, --cc
>     With this option the output produced by --diff-merges=combined is
>     further compressed by omitting uninteresting hunks whose contents
>     in the parents have only two variants and the merge result picks one
>     of them without modification.  --cc implies -p.
>
> Why do -c and -cc imply -p, but -m does not? I tried to use both `git
> log -c` and `git log -m` today and was confused when the latter didn't
> produce any output. Could we change this behavior in a future version
> of Git?

Patches to fix this are almost ready, but I'd like to make a warning
that you'd likely be even more confused by the current output of "-m",
unless you set "log.diffMerges" configuration option to "first-parent".
These diffs with respect to /second/ parent at the end of the output
made me really mad once upon a time.

-- Sergey Organov