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

Re: [PATCH 4/7] checkout: fix merge.conflictstyle handling

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 11, 2021, 14:34 UTC
Message-ID
<60c37480c6ab9_3ad920882@natae.notmuch>
In-Reply-To
<5164b67c-d701-077f-7743-aea4ae13779d@gmail.com>
Phillip Wood wrote:
Show 41 quoted lines
> On 10/06/2021 17:32, Felipe Contreras wrote:
> > Phillip Wood wrote:
> >> On 10/06/2021 15:11, Felipe Contreras wrote:
> >>> Phillip Wood wrote:
> >>>> On 09/06/2021 20:28, Felipe Contreras wrote:
> >>>>> Currently both merge.conflictStyle and `git commit --merge
> >>>>> --conflict=diff3` don't work together, since the former wrongly
> >>>>> overrides the later.
> >>>>>
> >>>>> The way merge configurations are handled is not correct.
> >>>>> It should be possible to do git_config(merge_recursive_config, ...) just
> >>>>> like we can with git_diff_basic_config and others.
> >>>>
> >>>> It would be helpful to explain what the problem with
> >>>> merge_recursive_config() actually is rather than just saying "it should
> >>>> be possible ..."
> >>>
> >>> The problem is that you can't do this:
> >>>
> >>>     git_config(merge_recursive_config, NULL);
> >>>
> >>> As it was explained.
> >>
> >> You do not explain why you cannot do that
> > 
> >    % git grep merge_recursive_config
> >    static void merge_recursive_config(struct merge_options *opt)
> > 
> > For starters it's a static function.
> > 
> > Second, clearly the type of functions git_config() receives are not
> > `void (*)(struct merge_options *)`.
> > 
> > I mean, I do see value in explaning as much detail as needed in the
> > commit message, but it shouldn't be a lesson on git's codebase:
> > git_config() is a standard thing, and it's even mentioned in the user
> > manual.
> 
> I'm not asking for a lesson on git's config system, I'm asking you to 
> add a sentence to the commit message to explain what the problem is 
> rather than just saying "you should be able to do this but you can't".

Yes, but why? What possible reason could there be for this to fail? Can you list two?

  git_config(merge_recursive_config, NULL);
But more importantly, why does it matter? How would it change the patch?
Show 39 quoted lines
> > https://git-scm.com/docs/user-manual#birdview-on-the-source-code
> > 
> >>> That is the problem. I don't know how that's not clear.
> >>>
> >>>>> Therefore builtins like `git merge` can't call this function at the
> >>>>> right time.
> >>>>    >
> >>>>> We shuffle the functions a little bit so at least merge_recursive_config
> >>>>> doesn't call git_xmerge_config directly and thus override previous
> >>>>> configurations.
> >>>>
> >>>> Rather than papering of the problem, how difficult would it be to add a
> >>>> field to ll_merge_options and pass the conflict style with that rather
> >>>> than fiddling with the order that we set a global variable.
> >>>
> >>> Probably not that difficult, but then we also need a parser that
> >>> converts from "diff3" to whatever values we decide in that new field. We
> >>> would need a new parse_config_conflict_style() function.
> >>> And that function will be only used by `git checkout` and nothing else.
> >>> So I don't think there's much value in it.
> >>
> >> It would allow us to add a --conflict option to all the mergey commands
> >> in the future and would be much easier to reason about than the approach
> >> of juggling where we call git_xmerge_config().
> > 
> > Feel free to write a patch for that.
> > 
> >> This patch requires us to audit all the code paths that end up in
> >> merge_recursive_config() to make sure they now call
> >> git_xmerge_config() themselves. You don't seem to have done that as
> >> you don't know if am/apply are affected or not.
> > 
> > That is a separate issue, that I already mentioned...
> 
> I know you are going to add some tests but the point is that when making 
> a change like this you need to actively audit all the callers of 
> init_merge_options() and ensure that they are now calling 
> git_config(git_xmerge_config) and base you tests on what you find while 
> doing that.
And what makes you think I haven't?
If developers were perfect there would be no need for code review.
> Have you run 'grep init_merge_options()' to see where it is 
> being called?
Now that is insulting.
Cheers.
-- 
Felipe Contreras
Previous: Phillip WoodNext: Phillip Wood
Message 58 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.