From: Emily Shaffer <emilyshaffer@google.com>
To: Philip Oakley <philipoakley@iee.email>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] config: add 'config.superproject' file
Date: Tue, 13 Apr 2021 11:05:02 -0700 [thread overview]
Message-ID: <YHXdTg8cm5yUWt5J@google.com> (raw)
In-Reply-To: <e19a250a-c4ca-fc32-83f9-a03aa03cd88a@iee.email>
On Fri, Apr 09, 2021 at 12:10:27PM +0100, Philip Oakley wrote:
>
> On 09/04/2021 00:39, Emily Shaffer wrote:
> > Some configs, such as wrapper directives like gerrit.createChangeId, or
> > forthcoming hook configs, should apply to a superproject as well as all
> > its submodules. It may not be appropriate to apply them globally - for
> > example, if the user also contributes to many projects which do not use
> > the configs necessary for one project-with-submodules - and it may be
> > burdensome to apply them locally to the superproject and each of its
> > submodules. Even if the user runs 'git submodule foreach "git config
> > --local foo.bar', if a new submodule is added later on, that config is
> > not applied to the new submodule.
> >
> > It is also inappropriate to share the entire superproject config, since
> > some items - like remote URLs or partial-clone filters - would not apply
> > to a submodule.
> >
> > To make life easier for projects with many submodules, then, create a
> > new "config.superproject" config scope, which is included in the config
> > parse for the superproject as well as for all the submodules of that
> > superproject.
> >
> > For the superproject, this new config file is equally local to the local
> > config; for the submodule, the new config file is less local than the
> > local config. So let's include it directly before the local config
> > during the config parse.
> >
> > Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> > ---
>
> Does this need an update to the `git config --show-origin --show-scope`
> capability?
It's included:
> > --- a/config.c
> > +++ b/config.c
> > @@ -3515,6 +3539,8 @@ const char *config_scope_name(enum config_scope scope)
> > return "command";
> > case CONFIG_SCOPE_GITMODULES:
> > return "gitmodules";
> > + case CONFIG_SCOPE_SUPERPROJECT:
> > + return "superproject";
> > default:
> > return "unknown";
> > }
> > diff --git a/config.h b/config.h
> > index 535f5517b8..b42e1d13eb 100644
> > --- a/config.h
> > +++ b/config.h
> > @@ -43,6 +43,7 @@ enum config_scope {
> > CONFIG_SCOPE_WORKTREE,
> > CONFIG_SCOPE_COMMAND,
> > CONFIG_SCOPE_GITMODULES,
> > + CONFIG_SCOPE_SUPERPROJECT,
> > };
> > diff --git a/t/t1311-superproject-config.sh b/t/t1311-superproject-config.sh
> > new file mode 100755
> > index 0000000000..650c4d24c7
> > --- /dev/null
> > +++ b/t/t1311-superproject-config.sh
> > +test_expect_success 'can --show-origin the superproject config' '
> > + git config --superproject --add foo.bar baz &&
> > +
> > + git config --list --show-origin >actual &&
> > + grep -F "config.superproject" actual &&
> > +
> > + rm .git/config.superproject
> > +'
> > +
> > +test_expect_success 'can --show-scope the superproject config' '
> > + git config --superproject --add foo.bar baz &&
> > +
> > + git config --list --show-scope >actual &&
> > + grep "superproject" actual &&
> > +
> > + rm .git/config.superproject
> > +'
- Emily
next prev parent reply other threads:[~2021-04-13 18:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 23:39 [RFC PATCH 0/2] share a config between submodule and superproject Emily Shaffer
2021-04-08 23:39 ` [RFC PATCH 1/2] config: rename "submodule" scope to "gitmodules" Emily Shaffer
2021-04-08 23:39 ` [RFC PATCH 2/2] config: add 'config.superproject' file Emily Shaffer
2021-04-09 11:10 ` Philip Oakley
2021-04-13 18:05 ` Emily Shaffer [this message]
2021-04-09 14:35 ` Matheus Tavares Bernardino
2021-04-09 22:29 ` Junio C Hamano
2021-04-13 19:45 ` Emily Shaffer
2021-04-13 18:48 ` Emily Shaffer
2021-04-14 10:32 ` Future structure of submodules and .git/, .git/modules/* organization Ævar Arnfjörð Bjarmason
2021-04-15 21:25 ` Emily Shaffer
2021-04-15 21:41 ` Junio C Hamano
2021-04-23 0:15 ` [RFC PATCH v2 0/4] share a config between submodule and superproject Emily Shaffer
2021-04-23 0:15 ` [RFC PATCH v2 1/4] config: rename "submodule" scope to "gitmodules" Emily Shaffer
2021-04-23 9:46 ` Phillip Wood
2021-04-23 0:15 ` [RFC PATCH v2 2/4] t1510-repo-setup: don't use exact matching on traces Emily Shaffer
2021-04-23 9:59 ` Phillip Wood
2021-04-23 0:15 ` [RFC PATCH v2 3/4] t7006-pager.sh: more lenient trace checking Emily Shaffer
2021-04-23 9:54 ` Phillip Wood
2021-04-23 12:45 ` Phillip Wood
2021-04-23 0:15 ` [RFC PATCH v2 4/4] config: add 'config.superproject' file Emily Shaffer
2021-04-23 12:08 ` Johannes Schindelin
2021-06-19 0:31 ` [PATCH v3 0/2] share a config between submodule and superproject Emily Shaffer
2021-06-19 0:31 ` [PATCH v3 1/2] config: rename "submodule" scope to "gitmodules" Emily Shaffer
2021-06-19 0:31 ` [PATCH v3 2/2] config: add 'config.superproject' file Emily Shaffer
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=YHXdTg8cm5yUWt5J@google.com \
--to=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=philipoakley@iee.email \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.