Re: [PATCH 00/26] git-log: implement new --diff-merge options
- From
Elijah Newren <newren@gmail.com>
- Date
- Dec 8, 2020, 20:52 UTC
- Message-ID
- <CABPp-BGuLX8Msghbo6L7vB2Wqys=Xg_uvV2Aui-1q4-+ijuNEw@mail.gmail.com>
- In-Reply-To
- <87y2i8dptj.fsf@osv.gnss.ru>
Hi Sergey,
On Tue, Dec 8, 2020 at 12:07 PM Sergey Organov <sorganov@gmail.com> wrote:
Show 21 quoted lines
> > Sergey Organov <sorganov@gmail.com> writes: > > > [...] > > > The series also cleanup logic of handling of diff merges options and > > fix an issue found in the original implementation where logically > > mutually exclusive options -m/-c/--cc failed to actually override each > > other. > > Working further on this, I've noticed very irregular interactions > between -m/-c/--cc and --oneline: > > 1. --oneline disables -m output for 'git log', and leaves -m output enabled > for 'git show': > > $ /usr/bin/git show -n1 -m --oneline 2e673356aef | wc -l > 80 > $ /usr/bin/git log -n1 -m --oneline 2e673356aef | wc -l > 1
If you leave off --oneline, you'll note that git show produces a diff and git log does not (regardless of whether 2e673356aef is a merge commit or a regular commit). So, I don't think this is related to --oneline.
Show 12 quoted lines
> 2. For 'git log', --oneline disables -m output, and leaves -c/--cc output > enabled: > > $ /usr/bin/git log -n1 -m --oneline 2e673356aef | wc -l > 1 > $ /usr/bin/git log -n1 -c --oneline 2e673356aef | wc -l > 16 > $ /usr/bin/git log -n1 --cc --oneline 2e673356aef | wc -l > 16 > > The question is: what's the right interaction between --oneline and > -m/-c/--cc?
I believe the right question is: Should -m be a no-op unless -p is also specified? In the past, --cc and -c were no-ops except when -p was also specified. It was somewhat unfriendly and surprising, and thus was changed so that --cc and -c implied -p (and thus would cause output for non-merge commits to be shown differently, namely shown with a diff, in addition to affecting the type of diff shown for merge commits). I think -m was overlooked at the time.
> I tend to think they should be independent, so that --oneline doesn't > affect diff output, and then the only offender is -m.
I agree that they should be independent, but I believe they are already independent unless you have more evidence of weirdness somewhere. The differences you are seeing are due to -m, -c, and --cc being handled differently, and I think we should probably just give -m the same treatment that we give to -c and --cc (namely, make all three imply -p).
Hope that helps, Elijah