Re: [PATCH v2 0/7] making log --first-parent imply -m
From: Sergey Organov <hidden>
Date: 2020-08-02 13:00:01
Jeff King [off-list ref] writes:
On Thu, Jul 30, 2020 at 12:41:39AM +0300, Sergey Organov wrote:quoted
quoted
Here's a re-roll taking into account the discussion so far: - the escape hatch option name is flipped to "--no-diff-merges" (with "--diff-merges" matching "-m")Rather than being just a synonym for -m, is there a chance for "--diff-merges" implementation to be turned to output diff to the first parent only, no matter if --first-parent is active or not? Alternatively, may it have a parameter such as "-m parent-number" of "git cherry-pick" being set to "1" by default?Yes, I agree that would be a useful feature, but I don't think it needs to be part of this series. It could be implemented as --diff-merges=1 to show only the one against the first parent, or as its own option. But we can add that on top.quoted
This -m output of diffs to all the parents is in fact primary source of confusion for me, even over all these mind-blowing inter-dependencies between --first-parent, --cc, -c, -m, -p and what not. Who ever needs these (potentially huge) diffs against other parents, anyway?I've used "-m" second-parent diffs occasionally for hunting down mismerges, etc, but I agree that most of the time you just want to see the diff against the first parent.quoted
Introduction of this new option is a great opportunity for improvement that would be a pity to miss.Adding an optional value to the flag is something we can do later. We would miss the opportunity for "--diff-merges" to default to "--diff-merges=1", but I'm not sure I'd want to do that anyway. Having it be consistent with "-m" seems less confusing to me, and it is already too late to change that. If we want an option that defaults to "1", we can give it a new name. The only thing that is lost now is that --diff-merges would already be taken. :) But I think I'd probably call such an option "--diff-parents" or something like that anyway.
Yeah, I see your point, thanks for considering! What I in fact have in mind is something like: --diff-merges[=<parent-number>|c|cc|all] to have a single point of definition of the needed format of merges representation. Then comes the question of the default. "all" is what'd make it behave as "-m" behaves now. If it's too late for --diff-merges to have different default, could the default possibly be a configuration option rather than yet another command-line option? -- Sergey