git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 7/7] xdiff: make diff3 the default conflictStyle

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 13, 2021, 14:34 UTC
Message-ID
<60c6175ca6840_41f2b208fc@natae.notmuch>
In-Reply-To
<CABPp-BGhaSJmqXFKpCVcUKexNXaa8sLEms-6q-qno7uETzGQ=A@mail.gmail.com>
Elijah Newren wrote:
Show 46 quoted lines
> On Fri, Jun 11, 2021 at 2:05 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > Elijah Newren wrote:
> > > On Fri, Jun 11, 2021 at 10:57 AM Felipe Contreras <felipe.contreras@gmail.com> wrote:
> >
> > > > 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.
> 
> Yep, probably should have just been
> 
> +     if (opts->virtual_ancestor)
> +             xmp.favor = XDL_MERGE_FAVOR_BASE;
> 
> Though the difference doesn't matter a lot.  Since
> merge.conflictStyle=merge (which is the current default) doesn't
> display the contents from the merge base in a three-way content merge,
> setting xmp.favor to XDL_MERGE_FAVOR_BASE vs. leaving it as 0 for the
> recursive/intermediate merges won't generally end up affecting the end
> result.  It'd only matter for diff3 and zdiff3 users.
OK, so:
  if (git_xmerge_style > 0 && opts->virtual_ancestor)
Show 7 quoted lines
> Going on a slight tangent, I think there's actually a related bug
> here.  We probably should not honor XDL_MERGE_FAVOR_{OURS,THEIRS} when
> opts->virtual_ancestor is true; that's just asking for trouble.  I
> think it'd paradoxically result in reversing the desired behavior
> (e.g. users would see what they'd consider XDL_MERGE_FAVOR_THEIRS
> behavior when they asked for XDL_MERGE_FAVOR_OURS) in some cases as a
> result.
Maybe write a test-case and find out?
Show 20 quoted lines
> > 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.
> >
> > > > 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.
> 
> If someone that does lots of criss-cross merges can comment on the
> idea, and agree that it's worth a shot, I can try to turn it into real
> patches.

I would flip the conditional: if nobody that does lots of criss-crosses objects...

If we waited for a tiny minority of users to speak up before doing something we migth wait forever.

> (I might even try to investigate the zdiff3 stuff too, which sounds
> like something I've wanted many times...but I'd really rather
> concentrate on merge-ort until its upstreaming is finished.)
Well, I just re-sent the patch:
https://lore.kernel.org/git/20210613143155.836591-1-felipe.contreras@gmail.com/
Cheers.
-- 
Felipe Contreras
Previous: Elijah Newren
Message 69 of 69 in “Make diff3 the default conflict style”
  1. 0/7 Make diff3 the default conflict styleFelipe Contreras, Jun 9, 2021
  2. 1/7 test: add merge style config testFelipe Contreras, Jun 9, 2021
  3. Eric SunshineJun 9, 2021
  4. Felipe ContrerasJun 9, 2021
  5. Phillip WoodJun 10, 2021
  6. Felipe ContrerasJun 10, 2021
  7. Phillip WoodJun 10, 2021
  8. Felipe ContrerasJun 10, 2021
  9. Phillip WoodJun 10, 2021
  10. Felipe ContrerasJun 10, 2021
  11. Phillip WoodJun 11, 2021
  12. Felipe ContrerasJun 11, 2021
  13. 3/7 notes: fix merge.conflictstyle handlingFelipe Contreras, Jun 9, 2021
  14. 7/7 xdiff: make diff3 the default conflictStyleFelipe Contreras, Jun 9, 2021
  15. Johannes SixtJun 10, 2021
  16. Đoàn Trần Công DanhJun 10, 2021
  17. Felipe ContrerasJun 10, 2021
  18. Felipe ContrerasJun 10, 2021
  19. Jeff KingJun 10, 2021
  20. Felipe ContrerasJun 10, 2021
  21. Jeff KingJun 10, 2021
  22. Junio C HamanoJun 11, 2021
  23. Johannes SixtJun 11, 2021
  24. Junio C HamanoJun 11, 2021
  25. Johannes SixtJun 11, 2021
  26. Junio C HamanoJun 11, 2021
  27. Sergey OrganovJun 11, 2021
  28. Felipe ContrerasJun 11, 2021
  29. Sergey OrganovJun 11, 2021
  30. Felipe ContrerasJun 11, 2021
  31. Johannes SixtJun 11, 2021
  32. Felipe ContrerasJun 11, 2021
  33. Sergey OrganovJun 11, 2021
  34. Felipe ContrerasJun 11, 2021
  35. Sergey OrganovJun 11, 2021
  36. Felipe ContrerasJun 11, 2021
  37. Felipe ContrerasJun 11, 2021
  38. Johannes SixtJun 11, 2021
  39. Felipe ContrerasJun 11, 2021
  40. Felipe ContrerasJun 11, 2021
  41. Phillip WoodJun 10, 2021
  42. Felipe ContrerasJun 10, 2021
  43. 5/7 xdiff: rename XDL_MERGE_STYLE_DIFF3Felipe Contreras, Jun 9, 2021
  44. Phillip WoodJun 10, 2021
  45. Felipe ContrerasJun 10, 2021
  46. Junio C HamanoJun 11, 2021
  47. Felipe ContrerasJun 11, 2021
  48. 6/7 xdiff: simplify style assignmentsFelipe Contreras, Jun 9, 2021
  49. Phillip WoodJun 10, 2021
  50. Felipe ContrerasJun 10, 2021
  51. 2/7 merge-tree: fix merge.conflictstyle handlingFelipe Contreras, Jun 9, 2021
  52. 4/7 checkout: fix merge.conflictstyle handlingFelipe Contreras, Jun 9, 2021
  53. Phillip WoodJun 10, 2021
  54. Felipe ContrerasJun 10, 2021
  55. Phillip WoodJun 10, 2021
  56. Felipe ContrerasJun 10, 2021
  57. Phillip WoodJun 11, 2021
  58. Felipe ContrerasJun 11, 2021
  59. Phillip WoodJun 11, 2021
  60. Phillip WoodJun 17, 2021
  61. Felipe ContrerasJun 17, 2021
  62. Felipe ContrerasJun 11, 2021
  63. Elijah NewrenJun 11, 2021
  64. Felipe ContrerasJun 11, 2021
  65. Felipe ContrerasJun 11, 2021
  66. Elijah NewrenJun 11, 2021
  67. Felipe ContrerasJun 11, 2021
  68. Elijah NewrenJun 11, 2021
  69. Felipe ContrerasJun 13, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.