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

Re: [PATCH v4] mergetool: new config guiDefault supports auto-toggling gui by DISPLAY

From
David Aguilar <davvid@gmail.com>
Date
Apr 6, 2023, 03:33 UTC
Message-ID
<CAJDDKr53xaMyTVWOwBT=sjKuRf78SkNCcfdS99sRF3-CPV4=Lg@mail.gmail.com>
In-Reply-To
<xmqq355fz8pe.fsf@gitster.g>
On Tue, Apr 4, 2023 at 1:35 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 49 quoted lines
>
> Tao Klerks <tao@klerks.biz> writes:
>
> > If you get it wrong, an inconvenient or even bad
> > thing happens: If you're in a GUI context and you forget to say
> > `--gui`, then you get the CLI tool - not the end of the world, you
> > might argue. If you're in a non-GUI context and you say `--gui`, you
> > get a (hopefully intelligible) error about not finding a display, or
> > worst case, you hang - and git doesn't know what happened, the
> > messaging has to assume you aborted explicitly.
>
> The worst case I can think of is if you have a machine that allows a
> persistent virtual graphical session (remote desktop).  You can go
> there, open a terminal and create a screen session, which captures
> the $DISPLAY in effect.  You may disconnect from the screen session
> before you disconnect from the remote desktop.  As the remote
> desktop is persistent, the $DISPLAY would be valid even after you
> disconnect from there.
>
> Then you ssh into the machine and connect to the screen session.  If
> you say "xterm &" in that screen session, a new window with a
> terminal will open and be shown on that remote display session,
> which you cannot see until you reconnect to the remote desktop.
> Running "git mergetool --gui" would be the same.
>
> With the proposed patch, the experience would become even worse in
> that scenario, I am afraid.  "git mergetool" (without "--[no-]gui")
> would detect the presense of $DISPLAY and start a GUI mergetool that
> you cannot view or interact with ;-).  You need to explicitly say
> "git mergetool --no-gui" in such a case to force use of cli tool.
>
> Even with that caveat, I think the proposed behaviour would be a net
> improvement.  I almost always work in non-GUI environment, but I can
> see many people work in both and depending on their environment wish
> to use the best tool for the situation.
>
> > If there were a way to get git to autoselect "--gui" by presence of
> > the DISPLAY, as it does for the *default* mergetool, then this kind of
> > flow would be much more intuitive, usable, etc.
> >
> > I'm not sure whether I'm explaining better, or just repeating myself,
> > so I'll stop here :)
>
> Hopefully your explanation was clear enough.  Others may be able to
> offer solution better than "look at DISPLAY and choose --[no-]gui
> when neither is given from the command line", but I think at least I
> understand your motivation behind this change.
>
> Thanks.

Thanks for the thorough explanation. With that in mind, this all sounds good to me.

-- 
David
Previous: Junio C Hamano
Message 23 of 23 in “mergetool: new config guiDefault supports auto-toggling gui by DISPLAY”
  1. mergetool: new config guiDefault supports auto-toggling gui by DISPLAYTao Klerks via GitGitGadget, Oct 12, 2022
  2. Tao KlerksOct 12, 2022
  3. Junio C HamanoOct 12, 2022
  4. Tao KlerksOct 13, 2022
  5. Junio C HamanoOct 13, 2022
  6. Tao KlerksOct 14, 2022
  7. Junio C HamanoOct 14, 2022
  8. Tao KlerksOct 14, 2022
  9. Junio C HamanoOct 14, 2022
  10. Tao KlerksOct 16, 2022
  11. RFC: mergetool: new config guiDefault supports auto-toggling gui by DISPLAYTao Klerks via GitGitGadget, Oct 14, 2022
  12. Eric SunshineOct 14, 2022
  13. Tao KlerksOct 14, 2022
  14. Junio C HamanoOct 14, 2022
  15. Tao KlerksOct 16, 2022
  16. Junio C HamanoOct 17, 2022
  17. RFC: mergetool: new config guiDefault supports auto-toggling gui by DISPLAYTao Klerks via GitGitGadget, Oct 18, 2022
  18. Tao KlerksFeb 17, 2023
  19. mergetool: new config guiDefault supports auto-toggling gui by DISPLAYTao Klerks via GitGitGadget, Mar 18, 2023
  20. David AguilarApr 4, 2023
  21. Tao KlerksApr 4, 2023
  22. Junio C HamanoApr 4, 2023
  23. David AguilarApr 6, 2023

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.