git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: "Sarajärvi Tony" <Tony.Sarajarvi@digia.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Git --file doesn't override $HOME in version 1.8.1.2
Date: Tue, 9 Jul 2013 15:24:55 -0400	[thread overview]
Message-ID: <20130709192455.GC5153@sigill.intra.peff.net> (raw)
In-Reply-To: <87mwpweywu.fsf@linux-k42r.v.cablecom.net>

On Tue, Jul 09, 2013 at 01:49:21PM +0200, Thomas Rast wrote:

> Rather, it's very strange that 'git config --file foo' tries to look at
> any config file other than 'foo'.  In a git repo:
> 
>   $ strace git config --file fooconfig test.var 2>&1 | grep 'open.*config'
>   open("/home/thomas/.gitconfig", O_RDONLY) = 3
>   open(".git/config", O_RDONLY)           = 3
>   open("/home/thomas/.gitconfig", O_RDONLY) = 3
>   open(".git/config", O_RDONLY)           = 3
>   open("fooconfig", O_RDONLY)             = 3
> 
> I haven't looked into the code yet.  Probably it's simply following the
> usual code paths to discover a repo and read its config.  However, with
> the --file option, it shouldn't.

I'm not so sure. It is (in theory) OK to read the usual config files to
find out _how_ git-config should behave, but then return results from a
specific file. The former should read the "normal" files, and the latter
should read whatever is specified by the options ("--file", a specific
level like "--global", or the usual set of files).

There are probably not many config options that can affect git-config's
behavior. The few I can think of are:

  1. core.editor should affect "git config --edit"

  2. pager.config would auto-start a pager. I am not sure if that is a
     sane thing to do or not.

  3. In theory you could have advice.* affect git-config, but I do not
     think any currently do.

  4. Currently git-config does not read objects, but there are patches
     proposed to do so. In that case, things like core.packedGitWindowSize
     might be important.

So I think you could probably drop the config parsing, special-case (1),
and ignore (2) as silly. But I think (3) and (4) show that it isn't the
right thing to do; you will never know which config options affect
git-config's behavior in the future.

The real issue here is not the "extra" normal config parsing; it is that
the normal parsing does not work in some cases. And that has already
been fixed by Jonathan's 4698c8f (config: allow inaccessible
configuration under $HOME, 2013-04-12).

-Peff

  reply	other threads:[~2013-07-09 19:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 11:05 Git --file doesn't override $HOME in version 1.8.1.2 Sarajärvi Tony
2013-07-09 11:49 ` Thomas Rast
2013-07-09 19:24   ` Jeff King [this message]
2013-07-09 12:00 ` Junio C Hamano
2013-07-09 12:12   ` Sarajärvi Tony

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=20130709192455.GC5153@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Tony.Sarajarvi@digia.com \
    --cc=git@vger.kernel.org \
    --cc=trast@inf.ethz.ch \
    /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.
Code repositories for project(s) associated with this public inbox

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

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 read-only IMAP folder(s) and NNTP newsgroup(s).