git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Astril Hayato <astrilhayato@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitk: Comply with XDG base directory specification
Date: Tue, 21 Jan 2014 22:10:41 +1100	[thread overview]
Message-ID: <20140121111041.GC8265@iris.ozlabs.ibm.com> (raw)
In-Reply-To: <1386963996-5481-1-git-send-email-astrilhayato@gmail.com>

On Fri, Dec 13, 2013 at 07:46:36PM +0000, Astril Hayato wrote:
> Write the gitk config data to $XDG_CONFIG_HOME/git/gitk ($HOME/.config/git/gitk
> by default) in line with the XDG specification. This makes it consistent with
> git which also follows the spec.
> 
> If $HOME/.gitk already exists use that for backward compatibility, so only new
> installations are affected.

Sounds reasonable...

> @@ -12058,7 +12061,27 @@ namespace import ::msgcat::mc
>  ## And eventually load the actual message catalog
>  ::msgcat::mcload $gitk_msgsdir
>  
> -catch {source ~/.gitk}
> +catch {
> +    # follow the XDG base directory specification by default. See
> +    # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
> +    if {[info exists env(XDG_CONFIG_HOME)] && $env(XDG_CONFIG_HOME) ne ""} {
> +	# XDG_CONFIG_HOME environment variable is set
> +	set config_file [file join $env(XDG_CONFIG_HOME) git gitk]
> +	set config_file_tmp [file join $env(XDG_CONFIG_HOME) git gitk-tmp]
> +    } else {
> +	# default XDG_CONFIG_HOME
> +	set config_file "~/.config/git/gitk"
> +	set config_file_tmp "~/.config/git/gitk-tmp"
> +    }
> +    if {![file exists $config_file]} {
> +	if {![file exists [file dirname $config_file]]} {
> +	    file mkdir [file dirname $config_file]
> +	}
> +	# for backward compatability use the old config file if it exists
> +	if {[file exists "~/.gitk"]} {set config_file "~/.gitk"}

Don't we need to set config_file_tmp here too?

And, do we really want to create the ~/.config/git directory if we are
using the old-style ~/.gitk as the config file?

Paul.

  reply	other threads:[~2014-01-21 11:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 19:46 [PATCH] gitk: Comply with XDG base directory specification Astril Hayato
2014-01-21 11:10 ` Paul Mackerras [this message]
2014-01-21 17:40   ` Astril Hayato

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

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

  git send-email \
    --in-reply-to=20140121111041.GC8265@iris.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=astrilhayato@gmail.com \
    --cc=git@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).