Re: [PATCH 00/26] git-log: implement new --diff-merge options
- From
Elijah Newren <newren@gmail.com>
- Date
- Dec 9, 2020, 03:06 UTC
- Message-ID
- <CABPp-BHCtrKAWR1v3OrUgX8iSfxvDwN8p+yiJy=G1BFfnSopjw@mail.gmail.com>
- In-Reply-To
- <xmqqtusv4w2g.fsf@gitster.c.googlers.com>
Hi Junio,
On Tue, Dec 8, 2020 at 5:17 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> > Elijah Newren <newren@gmail.com> writes: > > > ... I guess I'm not sure why one would ever > > want to see diffs for merges and not for normal commits. Even in the > > unusual case someone did, couldn't they just pass --merges (to strip > > out the normal commits entirely)? > > Giving "--merges" would skip the single-strand-of-pearls commits > entirely, not even showing their log messages, so it won't be an > equivalent substitute.
Right, I said that too in my parenthetical comment; --merges would strip out the normal commits entirely. As I said, I'm not sure why anyone would ever want to see diffs for merges and not for normal commits, the closest useful thing I can imagine is commit messages + diffs for just merges, stripping the normal commits. Is there a usecase here (other than the motivating example of trying to remove an inconsistency between -m and --cc output)?
I'd personally dislike needing to specify --cc and -p together when today I can specify just --cc. You said as much too at [1]. Have you since changed your mind?
[1] https://lore.kernel.org/git/1440110591-12941-1-git-send-email-gitster@pobox.com/
Show 11 quoted lines
> > Honestly, I find it a little surprising that despite the fact that log > > -p shows nothing for merge commits, that when I add --first-parent to > > see a subset of commits I suddenly get weird, huge diffs shown for the > > merges (yeah, yeah, I learned recently that it's documented behavior, > > so it's not surprising anymore, just weird). > > I view "--first-parent" as telling "git log" to pretend all merges > are single-parent commits (as if you did squash merges), and it is a > natural consequence if "log --first-parent -p" showed each commit > with its first parent, whether it is a merge or a single-parent > commit.
Alright, fair enough. I had always viewed it as commit limiting only (and thus why it looked weird to me), but I really don't use --first-parent or -m much.
But that leaves Sergey's question unanswered: should the inconsistency between --cc and -m (namely that only the former implies -p) be removed? If so, since --first-parent implies -m, what's the right way to avoid --first-parent becoming weird? (Allow explicit -m to imply -p, but not an implicit -m that came from --first-parent?)