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
Junio C Hamano <gitster@pobox.com>
Date
Apr 4, 2023, 20:35 UTC
Message-ID
<xmqq355fz8pe.fsf@gitster.g>
In-Reply-To
<CAPMMpohtL2dG_Ody5zALhS5kOuLLTTRw7L0vc6SnpWym+usppg@mail.gmail.com>
Tao Klerks <tao@klerks.biz> writes:
Show 7 quoted lines
> 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.

Show 6 quoted lines
> 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.
Previous: Tao KlerksNext: David Aguilar
Message 22 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.