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

Re: [PATCH] mergetool: do not enable hideResolved by default

From
Seth House <seth@eseth.com>
Date
Mar 9, 2021, 05:42 UTC
Message-ID
<YEcKy83ZmvGTAfxq@ellen.lan>
In-Reply-To
<YEbdj27CmjNKSWf4@google.com>
On Mon, Mar 08, 2021 at 06:29:35PM -0800, Jonathan Nieder wrote:
Show 7 quoted lines
> A typical mergetool uses four panes, showing the content of the file
> being resolved from MERGE_BASE ('BASE'), HEAD ('LOCAL'), MERGE_HEAD
> ('REMOTE'), and the working copy.  This allows understanding the
> conflicts in context: by seeing the entire content of the file from
> MERGE_HEAD, say, we can see the full intent of the code we are pulling
> in and understand what they were trying to do that conflicted with our
> own changes.
Well said. Agreed on all counts.

The very early days of these patch sets touched on this exact discussion point. (I'd link to it but that early discussion was a tad...unfocused.) I make semi-frequent reference of those versions of the conflicted file in the way you describe and have disabled hideResolved for a merge tool I maintain for that reason.

Show 7 quoted lines
>     No adverse effects were noted in a small survey of popular mergetools[1]
>     so this behavior defaults to `true`. However it can be globally disabled
>     by setting `mergetool.hideResolved` to `false`.
> 
> In practice, however, this has proved confusing for users.  No
> indication is shown in the UI that the base, local, and remote
> versions shown have been modified by additional resolution.

Compelling point. This flag drastically changes what LOCAL and REMOTE represent with little to no explanation.

There are three options to achieve the same end-goal of hideResolved that I've thought of:

1.  Individual merge tools should do this work, not Git.
    A merge tool already has all the information needed to hide
    already-resolved conflicts since that is what MERGED represents.
    Conflict markers *are* a two-way diff and a merge tool should
    display them as such, rather than display the textual markers
    verbatim.
    In many ways this is the ideal approach -- all merge tools could be
    doing this with existing Git right now but none have seemingly
    thought of doing so yet.
2.  Git could pass six versions of the conflicted file to a merge tool,
    rather than the current four.
    Merge tools could accept LOCAL, REMOTE, BASE, MERGED (as most
    currently do), and also LCONFL and RCONFL files. The latter two
    being copies of MERGED but "pre split" by Git into the left
    conflicts and the right conflicts.
    This would spare the merge tool the work of splitting MERGED. It may
    encourage them to continue displaying LOCAL and REMOTE as useful
    context but also make it easy to diff LCONFL with RCONFL and use
    that diff to actually resolve the conflict. It could also make
    things worse, as many tools simply diff _every_ file Git gives them
    regardless if that makes sense or not (>_<).
3.  Git could overwrite LOCAL and REMOTE to display only unresolved
    conflicts.
    (The current hideResolved addition.) This has the pragmatic benefit
    of requiring the least amount of change for all merge tools, but to
    your point above, *destroys* valuable data -- the additional context
    to help understand where the conflicts came from -- and that data
    can't be viewd without running additional Git commands to fetch it.

Defaulting hideResolved to off is a fine change IMO. We don't have a way to communicate to the end-user that LOCAL and REMOTE represent something markedly different than what they have traditionally represented, so having this be an opt-in will force the user to read the docs and understand the ramifications.

I really appreciate your thoughts that accompanied this patch. Sorry for the long response but your email made me want to ask the question:

Does the need to default hideResolved to off mean that it is the wrong approach?

Thinking through an end-user's workflow: would a user want to configure two copies of the same merge tool -- one with hideResolved and one without? An easy conflict could benefit from the former but if it's a tricky conflict the user would have to exit the tool and reopen the same tool without the flag. That sounds like an annoying workflow, and although the user would now have that extra, valuable context it would also put them squarely back into the current state of viewing already-resolved conflicts.

I know the Option 3, hideResolved, is merged and has that momentum and this patch looks good to me -- but perhaps Option 2 is more "correct", or Option 1, or yet another option I haven't thought of. Thoughts?

Previous: Jonathan NiederNext: Jonathan Nieder
Message 63 of 80 in “mergetool: remove unconflicted lines”
  1. 0/1 mergetool: remove unconflicted linesFelipe Contreras, Dec 23, 2020
  2. 1/1 mergetool: add automerge configurationFelipe Contreras, Dec 23, 2020
  3. Junio C HamanoDec 23, 2020
  4. Felipe ContrerasDec 23, 2020
  5. Junio C HamanoDec 23, 2020
  6. Felipe ContrerasDec 24, 2020
  7. Junio C HamanoDec 24, 2020
  8. Felipe ContrerasDec 24, 2020
  9. Junio C HamanoDec 24, 2020
  10. Felipe ContrerasDec 24, 2020
  11. Junio C HamanoDec 24, 2020
  12. Felipe ContrerasDec 27, 2020
  13. Junio C HamanoDec 24, 2020
  14. Felipe ContrerasDec 24, 2020
  15. Johannes SchindelinDec 30, 2020
  16. Felipe ContrerasDec 30, 2020
  17. 0/1 mergetool: add automerge configurationSeth House, Dec 27, 2020
  18. 2/2 mergetool: Add per-tool support for the autoMerge flagSeth House, Dec 27, 2020
  19. Junio C HamanoDec 27, 2020
  20. 1/2 mergetool: add automerge configurationSeth House, Dec 27, 2020
  21. Junio C HamanoDec 27, 2020
  22. Seth HouseDec 27, 2020
  23. Junio C HamanoDec 27, 2020
  24. 0/2 mergetool: add automerge configurationSeth House, Dec 28, 2020
  25. 2/2 mergetool: Add per-tool support for the autoMerge flagSeth House, Dec 28, 2020
  26. Felipe ContrerasDec 28, 2020
  27. 1/2 mergetool: add automerge configurationSeth House, Dec 28, 2020
  28. 0/4 mergetool: add automerge configurationSeth House, Dec 28, 2020
  29. 1/4 mergetool: add automerge configurationSeth House, Dec 28, 2020
  30. Johannes SixtDec 28, 2020
  31. 2/4 mergetool: Add per-tool support for the autoMerge flagSeth House, Dec 28, 2020
  32. Junio C HamanoDec 28, 2020
  33. 4/4 mergetool: Add automerge_enabled tool-specific override functionSeth House, Dec 28, 2020
  34. Johannes SixtDec 28, 2020
  35. Junio C HamanoDec 28, 2020
  36. 3/4 mergetool: Break setup_tool out into separate initialization functionSeth House, Dec 28, 2020
  37. Johannes SixtDec 28, 2020
  38. 0/5 mergetool: add automerge configurationSeth House, Dec 28, 2020
  39. 5/5 mergetool: add automerge_enabled tool-specific override functionSeth House, Dec 28, 2020
  40. Felipe ContrerasDec 29, 2020
  41. Junio C HamanoJan 6, 2021
  42. Seth HouseJan 7, 2021
  43. Junio C HamanoJan 7, 2021
  44. Seth HouseJan 7, 2021
  45. Junio C HamanoJan 7, 2021
  46. Johannes SchindelinJan 8, 2021
  47. 3/5 mergetool: add per-tool support for the autoMerge flagSeth House, Dec 28, 2020
  48. 4/5 mergetool: break setup_tool out into separate initialization functionSeth House, Dec 28, 2020
  49. Johannes SixtDec 29, 2020
  50. Seth HouseDec 29, 2020
  51. 2/5 mergetool: alphabetize the mergetool config docsSeth House, Dec 28, 2020
  52. 1/5 mergetool: add automerge configurationSeth House, Dec 28, 2020
  53. 0/3 mergetool: add hideResolved configuration (was automerge)Seth House, Jan 30, 2021
  54. 3/3 mergetool: add per-tool support and overrides for the hideResolved flagSeth House, Jan 30, 2021
  55. Junio C HamanoJan 30, 2021
  56. 2/3 mergetool: break setup_tool out into separate initialization functionSeth House, Jan 30, 2021
  57. 1/3 mergetool: add hideResolved configurationSeth House, Jan 30, 2021
  58. Junio C HamanoJan 30, 2021
  59. 0/3 mergetool: add hideResolved configuration (was automerge)Seth House, Feb 9, 2021
  60. 2/3 mergetool: break setup_tool out into separate initialization functionSeth House, Feb 9, 2021
  61. 1/3 mergetool: add hideResolved configurationSeth House, Feb 9, 2021
  62. mergetool: do not enable hideResolved by defaultJonathan Nieder, Mar 9, 2021
  63. Seth HouseMar 9, 2021
  64. Jonathan NiederMar 10, 2021
  65. Junio C HamanoMar 10, 2021
  66. Junio C HamanoMar 11, 2021
  67. Junio C HamanoMar 12, 2021
  68. Jonathan NiederMar 12, 2021
  69. Junio C HamanoMar 12, 2021
  70. 0/2 mergetool: do not enable hideResolved by defaultJonathan Nieder, Mar 13, 2021
  71. 1/2 mergetool: do not enable hideResolved by defaultJonathan Nieder, Mar 13, 2021
  72. 2/2 doc: describe mergetool configuration in git-mergetool(1)Jonathan Nieder, Mar 13, 2021
  73. Junio C HamanoMar 13, 2021
  74. Junio C HamanoMar 13, 2021
  75. 3/3 mergetool: add per-tool support and overrides for the hideResolved flagSeth House, Feb 9, 2021
  76. Junio C HamanoFeb 9, 2021
  77. Seth HouseFeb 9, 2021
  78. Junio C HamanoDec 28, 2020
  79. Felipe ContrerasDec 28, 2020
  80. Felipe ContrerasDec 28, 2020

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.