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

Re: [PATCH 2/3] mergetool-lib: keep a list of cross desktop merge tools

From
Johannes Sixt <j6t@kdbg.org>
Date
Aug 6, 2020, 08:16 UTC
Message-ID
<4ef90c30-6c06-a355-69eb-9c8e10c6bef6@kdbg.org>
In-Reply-To
<CAPig+cRX3_ArTYQwc1jWHznBxLf+j0McYSo=nPq4C319J=DBvg@mail.gmail.com>
Am 05.08.20 um 23:08 schrieb Eric Sunshine:
Show 32 quoted lines
> On Wed, Aug 5, 2020 at 3:53 PM Marco Trevisan (Treviño) via
> GitGitGadget <gitgitgadget@gmail.com> wrote:
>> Instead of repeating the same tools multiple times, let's just keep them
>> in another variable and list them depending the current desktop
>>
>> Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
>> ---
>> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
>> @@ -288,11 +288,12 @@ list_merge_tool_candidates () {
>>         if test -n "$DISPLAY"
>>         then
>> +               cross_desktop_tools="opendiff kdiff3 tkdiff xxdiff"
>>                 if is_desktop "GNOME"
>>                 then
>> -                       tools="meld opendiff kdiff3 tkdiff xxdiff $tools"
>> +                       tools="meld $cross_desktop_tools $tools"
>>                 else
>> -                       tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
>> +                       tools="$cross_desktop_tools meld $tools"
>>                 fi
> 
> I have mixed feelings about this change. On the one hand, I see the
> reason for doing it if the list of tools remains substantially the
> same in each case, but it also seems like it could become a burden,
> possibly requiring factoring the list into more pieces, as new
> platforms or tools are added.
> 
> What I might find more compelling is creation of a table of tools and
> the platforms for which they are suitable. It doesn't seem like it
> would be too difficult to express such a table in shell and to extract
> the desired rows (but that might be overkill). At any rate, I'm rather
> "meh" on this change, though I don't oppose it strongly.

There may be some confusion caused by the name of the new variable. A better name would perhaps be $tools_with_desktop_dependent_preference. (That's a tongue-in-cheek suggestion, BTW.)

On a side note, the refactoring that happened in 21d0ba7ebb0c ("difftool/mergetool: refactor commands to use git-mergetool--lib", 2009-04-08) did not preserve the original order of diff tools. The spirit was to prefer meld over kompare and kdiff3 with GNOME, and the other way round with KDE. But since that refactoring, kompare is always first in the list.

-- Hannes
Previous: Eric SunshineNext: Marco Trevisan (Treviño)
Message 8 of 17 in “mergetool-lib: Don't use deprecated variable to detect GNOME”
  1. 0/3 mergetool-lib: Don't use deprecated variable to detect GNOMEMarco Trevisan via GitGitGadget, Aug 5, 2020
  2. 1/3 mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOMEMarco Trevisan (Treviño) via GitGitGadget, Aug 5, 2020
  3. Eric SunshineAug 5, 2020
  4. Junio C HamanoAug 5, 2020
  5. Marco Trevisan (Treviño)Aug 6, 2020
  6. 2/3 mergetool-lib: keep a list of cross desktop merge toolsMarco Trevisan (Treviño) via GitGitGadget, Aug 5, 2020
  7. Eric SunshineAug 5, 2020
  8. Johannes SixtAug 6, 2020
  9. Marco Trevisan (Treviño)Aug 6, 2020
  10. Marco Trevisan (Treviño)Aug 6, 2020
  11. 3/3 mergetool-lib: give kdiff3 prioirty in KDE environmentsMarco Trevisan (Treviño) via GitGitGadget, Aug 5, 2020
  12. Eric SunshineAug 5, 2020
  13. Marco Trevisan (Treviño)Aug 6, 2020
  14. Eric SunshineAug 6, 2020
  15. 0/2 mergetool-lib: Don't use deprecated variable to detect GNOMEMarco Trevisan via GitGitGadget, Aug 6, 2020
  16. 1/2 mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOMEMarco Trevisan (Treviño) via GitGitGadget, Aug 6, 2020
  17. 2/2 mergetool-lib: give kdiff3 priority in KDE environmentsMarco Trevisan (Treviño) via GitGitGadget, Aug 6, 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.