diff mbox series

[3/3] mergetool-lib: give kdiff3 prioirty in KDE environments

Message ID 37090d232221415b227c165bd44f6711d21f376b.1596634463.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series mergetool-lib: Don't use deprecated variable to detect GNOME | expand

Commit Message

Jean-Noël Avila via GitGitGadget Aug. 5, 2020, 1:34 p.m. UTC
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>

Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
---
 git-mergetool--lib.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Eric Sunshine Aug. 5, 2020, 9:15 p.m. UTC | #1
On Wed, Aug 5, 2020 at 4:02 PM Marco Trevisan (Treviño) via
GitGitGadget <gitgitgadget@gmail.com> wrote:
> mergetool-lib: give kdiff3 prioirty in KDE environments

s/prioirty/priority/

> Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
> ---
> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> @@ -288,12 +288,15 @@ list_merge_tool_candidates () {
> -               cross_desktop_tools="opendiff kdiff3 tkdiff xxdiff"
> +               cross_desktop_tools="opendiff tkdiff xxdiff"
>                 if is_desktop "GNOME"
>                 then
> -                       tools="meld $cross_desktop_tools $tools"
> +                       tools="meld $cross_desktop_tools kdiff3 $tools"
> +               elif is_desktop "KDE"
> +               then
> +                       tools="kdiff3 $cross_desktop_tools meld $tools"
>                 else
> -                       tools="$cross_desktop_tools meld $tools"
> +                       tools="$cross_desktop_tools kdiff3 meld $tools"
>                 fi

Wouldn't this change the behavior for people running old KDE which
doesn't have XDG_CURRENT_DESKTOP, giving "kdiff3" much lower priority
than it had before?

This change also illustrates why I wasn't convinced that patch 2/3 was
necessarily a good idea. When you touch 'cross_desktop_tools' here,
you end up having to touch all the other 'tools=' lines anyhow, so the
introduction of 'cross_desktop_tools' didn't buy much in terms of
reduced maintenance cost.
Marco Trevisan (Treviño) Aug. 6, 2020, 12:36 p.m. UTC | #2
Il giorno mer 5 ago 2020 alle ore 23:16 Eric Sunshine
<sunshine@sunshineco.com> ha scritto:
>
> On Wed, Aug 5, 2020 at 4:02 PM Marco Trevisan (Treviño) via
> GitGitGadget <gitgitgadget@gmail.com> wrote:
> > mergetool-lib: give kdiff3 prioirty in KDE environments
>
> s/prioirty/priority/
>
> > Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
> > ---
> > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> > @@ -288,12 +288,15 @@ list_merge_tool_candidates () {
> > -               cross_desktop_tools="opendiff kdiff3 tkdiff xxdiff"
> > +               cross_desktop_tools="opendiff tkdiff xxdiff"
> >                 if is_desktop "GNOME"
> >                 then
> > -                       tools="meld $cross_desktop_tools $tools"
> > +                       tools="meld $cross_desktop_tools kdiff3 $tools"
> > +               elif is_desktop "KDE"
> > +               then
> > +                       tools="kdiff3 $cross_desktop_tools meld $tools"
> >                 else
> > -                       tools="$cross_desktop_tools meld $tools"
> > +                       tools="$cross_desktop_tools kdiff3 meld $tools"
> >                 fi
>
> Wouldn't this change the behavior for people running old KDE which
> doesn't have XDG_CURRENT_DESKTOP, giving "kdiff3" much lower priority
> than it had before?

Yeah, true.. So to avoid this we can just also check for
KDE_FULL_SESSION, that has been introduced by KDE 3.2, and this should
be enough I think.

> This change also illustrates why I wasn't convinced that patch 2/3 was
> necessarily a good idea. When you touch 'cross_desktop_tools' here,
> you end up having to touch all the other 'tools=' lines anyhow, so the
> introduction of 'cross_desktop_tools' didn't buy much in terms of
> reduced maintenance cost.

Yeah, I had the same feeling, TBH.
Eric Sunshine Aug. 6, 2020, 4:17 p.m. UTC | #3
On Thu, Aug 6, 2020 at 8:37 AM Marco Trevisan (Treviño) <mail@3v1n0.net> wrote:
> Il giorno mer 5 ago 2020 alle ore 23:16 Eric Sunshine
> <sunshine@sunshineco.com> ha scritto:
> > Wouldn't this change the behavior for people running old KDE which
> > doesn't have XDG_CURRENT_DESKTOP, giving "kdiff3" much lower priority
> > than it had before?
>
> Yeah, true.. So to avoid this we can just also check for
> KDE_FULL_SESSION, that has been introduced by KDE 3.2, and this should
> be enough I think.

I'm not a user of git-mergetool or KDE, so I can't speak as an
end-user. My comment was made merely as a reviewer of the code.

If it is easy to avoid the behavior change by also checking
KDE_FULL_SESSION in addition to the new check of XDG_CURRENT_DESKTOP
without it being a maintenance burden, then that sounds like a good
choice. On the other hand, if there wasn't a good way to avoid
changing behavior for users of older KDE, then explaining that in the
commit message would be expected.
diff mbox series

Patch

diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 243cd2b06b..90de6ee884 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -288,12 +288,15 @@  list_merge_tool_candidates () {
 	fi
 	if test -n "$DISPLAY"
 	then
-		cross_desktop_tools="opendiff kdiff3 tkdiff xxdiff"
+		cross_desktop_tools="opendiff tkdiff xxdiff"
 		if is_desktop "GNOME"
 		then
-			tools="meld $cross_desktop_tools $tools"
+			tools="meld $cross_desktop_tools kdiff3 $tools"
+		elif is_desktop "KDE"
+		then
+			tools="kdiff3 $cross_desktop_tools meld $tools"
 		else
-			tools="$cross_desktop_tools meld $tools"
+			tools="$cross_desktop_tools kdiff3 meld $tools"
 		fi
 		tools="$tools gvimdiff diffuse diffmerge ecmerge"
 		tools="$tools p4merge araxis bc codecompare"