Elijah Newren <newren@xxxxxxxxx> writes: > Hi Sergey, Hi Elijah, > > On Tue, Dec 8, 2020 at 12:07 PM Sergey Organov <sorganov@xxxxxxxxx> wrote: >> >> Sergey Organov <sorganov@xxxxxxxxx> 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. Yeah, looks exactly like this, thanks for correcting! > >> 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? Right. > 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). Well, so one surprise has been replaced with another, supposedly more friendly, right? I mean, obviously, with --cc I don't ask for diffs for non-merge commits, so it is still a surprise they are thrown at me. > I think -m was overlooked at the time. Looks like it was, but maybe there was rather an actual reason for not implying -p by -m? Maybe Junio will tell? > >> 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). I think that either all diff-merge options should imply -p, or none, from the POV of least surprise. However, it'd give us yet another challenge: for some time already, --first-parent implies -m, that once it starts to imply -p, will result in git log --first-parent suddenly producing diff output for everything. One way out I see is to specify that implied -m/-c/--cc don't imply -p, only explicit do. Entirely different approach is to get rid of -m/-c/--cc implying -p, and just produce diff output for merges independently on -p being provided or not. This will give us additional functionality (ability to get diff for merges, but not for regulars), and will get rid of all the related surprises. Thoughts? Thanks, -- Sergey Organov