From: Jakub Narebski <jnareb@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Eli Barzilay <eli@barzilay.org>,
Heiko Voigt <hvoigt@hvoigt.net>
Subject: Re: [PATCH/RFC] Hacky version of a glob() driven config include
Date: Fri, 07 May 2010 13:46:17 -0700 (PDT) [thread overview]
Message-ID: <m3k4rfe90n.fsf@localhost.localdomain> (raw)
In-Reply-To: <1273180440-8641-1-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> This is not ready for inclusion in anything. Commiting for RFC on
> whether this way of doing it is sane in theory.
I think this is a good idea at least in theory.
> Known bugs:
>
> * Breaks the model of being able to *set* config values. That
> doesn't work for the included files. Maybe not a bug.
Errr... do I understand correctly that it simply means that you are
not able to set config values that came from included files, in
included files?
This is quite serious limitation.
>
> * Errors in the git_config_from_file() call in glob_include_config()
> aren't passed upwards.
Hmmm...
>
> * It relies on the GNU GLOB_TILDE extension with no
> alternative. That can be done by calling getenv("HOME") and
> s/~/$home/.
"git config --path <variable>" expands leading '~' to $HOME, and ~user
to home directory of given user. Why not use this?
>
> * The whole bit with saving/restoring global state for config
> inclusion is evil, but then again so is the global state.
Why not encapsulate those global variables in a struct, passed to
appropriate functions, with a global variable holding an instance of
such struct (IIRC similarly to what is done for "the_index").
>
> * We don't check for recursion. But Git gives up eventually after
> after spewing a *lot* of duplicate entry errors. Not sure how to
> do this sanely w/symlinks.
The alternates mechanism has some depth limit; why not use it also for
config file inclusion? The machanism is quite similar...
>
> Not-signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
You can simply do not add Signed-off-by for an RFC patch...
> ---
>
> > On Sun, Apr 4, 2010 at 07:50, Eli Barzilay <eli@barzilay.org> wrote:
> > > Isn't it better to have a way to include files instead?
> >
> > Probably yes. Programs like Apache HTTPD, rsyslog and others just use
> > ${foo}conf.d by convention by supporting config inclusion.
>
> Here's an evil implementation of this. I know the code is horrid &
> buggy (see above). But is the general idea sane. I thought it would be
> better to submit this for comments before I went further with it.
>
> config.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++-
> t/t1300-repo-config.sh | 43 +++++++++++++++++++++++++++++++++++++
> 2 files changed, 97 insertions(+), 1 deletions(-)
No documentation.
[...]
> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
> index f11f98c..4df6658 100755
> --- a/t/t1300-repo-config.sh
> +++ b/t/t1300-repo-config.sh
> @@ -824,4 +824,47 @@ test_expect_success 'check split_cmdline return' "
> test_must_fail git merge master
> "
>
> +cat > .git/config << EOF
> +[some]
> + variable = blah
> +[voodoo]
> + include = .git/more_config_*
> +EOF
I don't like this syntax.
First, it forces git-config to hide all 'include' keys. I think there
might be some legitimate <section>.include config variables (perhaps
outside git-core); with this patch they are impossible.
Second, I guess that the section name has absolutely no meaning here.
If included config file has section.key config variable, i.e.:
[section]
key = value
the variable in master config file (visible by git-config) would not
be voodoo.section.key.
Third, what happens with the sections in master config file? If I
have the following in .git/config
[voodoo]
var1 = val1
include = .git/more_config
var2 = val2
and the .git/more_config has
[foo]
bar = baz
would "git config --list" see 'voodoo.var2' (i.e. sections in included
file does not change parsing of master file), or would it see
'foo.var2'?
I would propose
include .git/more_config_*
if not for the fast that it would trip older git. Perhaps
[include ".git/more_config_*"]
or
[include .git/more_config_*]
or
## include ".git/more_config_*"
--
Jakub Narebski
Poland
ShadeHawk on #git
next prev parent reply other threads:[~2010-05-07 20:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 21:20 Is there interest in reading ~/.gitconfig.d/* and /etc/gitconfig.d/*? Ævar Arnfjörð Bjarmason
2010-04-01 22:03 ` Heiko Voigt
2010-04-04 7:24 ` Peter Krefting
2010-04-04 7:59 ` Eli Barzilay
[not found] ` <19384.17579.205005.86711@winooski.ccs.neu.edu>
2010-04-06 8:15 ` Ævar Arnfjörð Bjarmason
2010-04-06 9:02 ` Jakub Narebski
2010-05-06 21:14 ` [PATCH/RFC] Hacky version of a glob() driven config include Ævar Arnfjörð Bjarmason
2010-05-07 6:00 ` Bert Wesarg
2010-05-07 16:56 ` Ævar Arnfjörð Bjarmason
2010-05-07 18:29 ` Bert Wesarg
2010-05-07 18:58 ` Ævar Arnfjörð Bjarmason
2010-05-07 19:02 ` Jacob Helwig
2010-05-07 19:52 ` Bert Wesarg
2010-05-07 20:11 ` [PATCH/RFC v2] " Ævar Arnfjörð Bjarmason
2010-05-07 20:46 ` Jakub Narebski [this message]
2010-05-07 22:15 ` [PATCH/RFC] " Ævar Arnfjörð Bjarmason
2010-05-07 23:43 ` Jakub Narebski
2010-05-08 2:30 ` Ping Yin
2010-05-08 8:18 ` Jakub Narebski
2010-05-08 9:03 ` Ping Yin
2010-05-08 5:06 ` 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
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=m3k4rfe90n.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=avarab@gmail.com \
--cc=eli@barzilay.org \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
/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).