git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: "Marco Trevisan (Treviño)" <mail@3v1n0.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: "Marco Trevisan (Treviño) via GitGitGadget"
	<gitgitgadget@gmail.com>, "Git List" <git@vger.kernel.org>
Subject: Re: [PATCH 1/3] mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOME
Date: Thu, 6 Aug 2020 14:12:49 +0200	[thread overview]
Message-ID: <CAALaSckL5sKynGDRoqN7vd6cuXAvGwaDSyB4tVGXxZWGkNG_gw@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cR_04fL85nH1tJnbWYbwk3Bn5fRqzr2JReB2xXu9iUGAQ@mail.gmail.com>

Hi,

Il giorno mer 5 ago 2020 alle ore 22:58 Eric Sunshine
<sunshine@sunshineco.com> ha scritto:
>
> On Wed, Aug 5, 2020 at 3:51 PM Marco Trevisan (Treviño) via
> GitGitGadget <gitgitgadget@gmail.com> wrote:
> > To list merge tool candidates we used to use a private GNOME env
> > variable (GNOME_DESKTOP_SESSION_ID) that has been deprecated for long time ago
> > and removed as part of GNOME 3.30.0 release [1].
> >
> > So, git should instead check the XDG_CURRENT_DESKTOP env variable, that
> > is supported by all the desktop environments.
> >
> > Since the variable is actually a colon-separated list of names that the current
> > desktop is known as, we need to go through all the values to ensure
> > we're using GNOME.
> >
> > Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
> > ---
> > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> > @@ -266,6 +266,19 @@ run_merge_cmd () {
> > +is_desktop () {
> > +       IFS=':'
>
> We usually want to restore the value of IFS after we're done with it.
> For instance:
>
>     OLDIFS=$IFS
>     IFS=:
>
> and then restore it before returning:
>
>     IFS=$OLDIFS

Yeah, that's true and always a good practice, but it was never
happening in this file, so I followed the style.

> > +       for desktop in ${XDG_CURRENT_DESKTOP}
> > +       do
> > +               if test "$desktop" = "$1"
> > +               then
> > +                       return 0
> > +               fi
> > +       done
> > +
> > +       return 1
> > +}
>
> Rather than looping and mucking with IFS, even easier would be:
>
> is_desktop () {
>     case ":$XDG_CURRENT_DESKTOP:" in
>     *:$1:*) return 0 ;;
>     *) return 1 ;;
>     esac
> }
>
> But perhaps that's too magical for people?

Ok, fair enough, this is fine as well.

> > @@ -275,7 +288,7 @@ list_merge_tool_candidates () {
> > -               if test -n "$GNOME_DESKTOP_SESSION_ID"
> > +               if is_desktop "GNOME"
>
> Why do we need to retire the $GNOME_DESKTOP_SESSION_ID check here,
> thus penalizing people who might still be on an old version of GNOME?
> It doesn't seem like it would be a maintenance burden to continue
> checking it while also taking advantage of $XDG_CURRENT_DESKTOP:
>
>     if test -n "$GNOME_DESKTOP_SESSION_ID" || is_desktop GNOME

Ok, keeping this as well, it's even true that most people won't be in
gnome 2 these days, but not a problem to keep it around.

-- 
Treviño's World - Life and Linux
http://www.3v1n0.net

  parent reply	other threads:[~2020-08-06 17:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 13:34 [PATCH 0/3] mergetool-lib: Don't use deprecated variable to detect GNOME Marco Trevisan via GitGitGadget
2020-08-05 13:34 ` [PATCH 1/3] mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOME Marco Trevisan (Treviño) via GitGitGadget
2020-08-05 20:58   ` Eric Sunshine
2020-08-05 22:14     ` Junio C Hamano
2020-08-06 12:12     ` Marco Trevisan (Treviño) [this message]
2020-08-05 13:34 ` [PATCH 2/3] mergetool-lib: keep a list of cross desktop merge tools Marco Trevisan (Treviño) via GitGitGadget
2020-08-05 21:08   ` Eric Sunshine
2020-08-06  8:16     ` Johannes Sixt
2020-08-06 12:19       ` Marco Trevisan (Treviño)
2020-08-06 12:28     ` Marco Trevisan (Treviño)
2020-08-05 13:34 ` [PATCH 3/3] mergetool-lib: give kdiff3 prioirty in KDE environments Marco Trevisan (Treviño) via GitGitGadget
2020-08-05 21:15   ` Eric Sunshine
2020-08-06 12:36     ` Marco Trevisan (Treviño)
2020-08-06 16:17       ` Eric Sunshine
2020-08-06 15:27 ` [PATCH v2 0/2] mergetool-lib: Don't use deprecated variable to detect GNOME Marco Trevisan via GitGitGadget
2020-08-06 15:27   ` [PATCH v2 1/2] mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOME Marco Trevisan (Treviño) via GitGitGadget
2020-08-06 15:27   ` [PATCH v2 2/2] mergetool-lib: give kdiff3 priority in KDE environments Marco Trevisan (Treviño) via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAALaSckL5sKynGDRoqN7vd6cuXAvGwaDSyB4tVGXxZWGkNG_gw@mail.gmail.com \
    --to=mail@3v1n0.net \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=sunshine@sunshineco.com \
    --subject='Re: [PATCH 1/3] mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOME' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git