Re: [PATCH 7/7] xdiff: make diff3 the default conflictStyle
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Jun 11, 2021, 21:05 UTC
- Message-ID
- <60c3d0296f869_8d0f208ec@natae.notmuch>
- In-Reply-To
- <20210611190235.1970106-1-newren@gmail.com>
Elijah Newren wrote:
> On Fri, Jun 11, 2021 at 10:57 AM Felipe Contreras <felipe.contreras@gmail.com> wrote:
Show 25 quoted lines
> > Or just use the base of the virtual merge: > > > > <<<<<<< HEAD > > D > > ||||||| merged common ancestors > > 1 > > ======= > > C > > >>>>>>> C > > I think that implementing this choice would look like this (again, not > compiled or tested and I'm not familiar with xdiff so take it with a > big grain of salt): > > > diff --git a/ll-merge.c b/ll-merge.c > index 095a4d820e..dbc7f76951 100644 > --- a/ll-merge.c > +++ b/ll-merge.c > @@ -130,6 +130,8 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused, > memset(&xmp, 0, sizeof(xmp)); > xmp.level = XDL_MERGE_ZEALOUS; > xmp.favor = opts->variant; > + if (git_xmerge_style >= 0 && opts->virtual_ancestor) > + xmp.favor = XDL_MERGE_FAVOR_BASE;
The only time git_xmerge_style isn't >= 0 is when no merge style has been configured by the user.
I don't see why this:
git -c merge.conflictstyle=merge merge
Should have a different behavior than this:
git merge
In fact, I don't see why any style should change that desired behavior. If you said there's issues with the "merge" style too, perhaps the above will help for those cases too.
Show 7 quoted lines
> > We don't have to use diff3 all the way. > > Right, thus my mention in the other email to consider adding a > XDL_MERGE_FAVOR_BASE -- which you then also mention here in your third > option, and which I've now given at least a partial patch for. Not > sure if it's a crazy idea or a great idea, since I don't do very many > criss-cross merges myself.
I thought you meant as a separate configurable flag, not something done by default.
Now that I understand what you meant I think it could be a great idea.
Cheers.
-- Felipe Contreras