From: Jeff King <peff@peff.net>
To: David Aguilar <davvid@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/2] config includes, take 2
Date: Tue, 7 Feb 2012 00:17:19 -0500 [thread overview]
Message-ID: <20120207051719.GA11598@sigill.intra.peff.net> (raw)
In-Reply-To: <CAJDDKr6A2UvB3D-Dapw7WCEzWfzLoLd0E8MSDjT0RtdxFeWZAQ@mail.gmail.com>
On Mon, Feb 06, 2012 at 09:01:21PM -0800, David Aguilar wrote:
> I have a questions about this. Let's say I have ~/foo1.gitconfig:
>
> [foo]
> bar = 1
>
> ...and ~/.gitconfig (I forgot the syntax):
>
> [foo]
> bar = 0
>
> #include "~/foo1.gitconfig"
>
>
> Does that mean that:
>
> $ git config -f ~/.gitconfig foo.bar
>
> ...prints 0 and not 1?
Yes, though the syntax is:
[include]
path = foo1.gitconfig
(it doesn't respect tilde-expansion, but it probably should). Note that
the syntax was specifically selected for backwards compatibility, and to
allow manipulation with existing tools.
> I can see cases where this would be undesirable behavior.
>
> For example, an application that uses "git config -z --list -f
> ~/.gitconfig" might expect that the result encompasses all of the
> user-specific config bits.
The problem is that an application might also expect it _not_ to happen
(e.g., if the application is really interested in knowing what's in
~/.gitconfig). Because includes aren't respected now, the safe default
seems to be not to have includes (i.e., don't change behavior for this
case).
A bigger question for me is: if you are interested in getting an answer
from anywhere, why are you restricting with "-f"? IOW, is this a
real-world problem, or a hypothetical one? And if real-world, what is
the actual use case?
> Following this to its natural conclusion means "git config" might
> learn some kind of --no-include flag for use with e.g. "git config
> --no-include -f ~/.gitconfig". That said, I don't know where I would
> ever actually use such a flag.
It already learned it as part of my series (and --includes, as well).
> I do know where I would use an `--include` flag (if following includes
> were not the default behavior when using '-f'), though, and that's why
> I'm asking. The problem with not having it be the default means we
> have to use a flag. This makes it harder to support multiple versions
> of git.
Yes, that's a general problem of adding new command-line options to turn
features off or on. We could add an environment variable to control this
feature. But I'd really like to hear the compelling use case first
(i.e., both why it cannot simply be spelled "git config -z --list", and
why not following includes is not OK).
> Maybe I'm mis-interpreting what you mean by, 'do not use includes for
> "git config" in single-file mode', though.
No, I think you understand the described behavior.
-Peff
next prev parent reply other threads:[~2012-02-07 5:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 6:27 [PATCH 0/2] config includes, take 2 Jeff King
2012-02-06 6:29 ` [PATCH 1/2] imap-send: remove dead code Jeff King
2012-02-06 6:31 ` [PATCH 2/2] config: add include directive Jeff King
2012-02-06 7:41 ` [PATCH 0/2] config includes, take 2 Junio C Hamano
2012-02-06 9:53 ` Michael Haggerty
2012-02-06 10:06 ` Jeff King
2012-02-06 10:16 ` Jeff King
2012-02-07 5:01 ` David Aguilar
2012-02-07 5:17 ` Jeff King [this message]
2012-02-07 10:05 ` David Aguilar
2012-02-07 17:30 ` Jeff King
2012-02-07 18:03 ` Junio C Hamano
2012-02-07 18:29 ` Jeff King
2012-02-07 19:16 ` Jakub Narebski
2012-02-07 19:21 ` Jeff King
2012-02-07 20:15 ` David Aguilar
2012-02-09 3:30 ` Jeff King
2012-02-09 19:24 ` Jakub Narebski
2012-02-09 19:33 ` Jeff King
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=20120207051719.GA11598@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=davvid@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).