git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 2/2] config: add 'config.superproject' file

From
Emily Shaffer <emilyshaffer@google.com>
Date
Apr 13, 2021, 18:05 UTC
Message-ID
<YHXdTg8cm5yUWt5J@google.com>
In-Reply-To
<e19a250a-c4ca-fc32-83f9-a03aa03cd88a@iee.email>
On Fri, Apr 09, 2021 at 12:10:27PM +0100, Philip Oakley wrote:
Show 31 quoted lines
> 
> 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:
Show 21 quoted lines
> > --- 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,
> >  };
Show 22 quoted lines
> > 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
Previous: Philip OakleyNext: Matheus Tavares Bernardino
Message 5 of 22 in “share a config between submodule and superproject”
  1. 0/2 share a config between submodule and superprojectEmily Shaffer, Apr 8, 2021
  2. 1/2 config: rename "submodule" scope to "gitmodules"Emily Shaffer, Apr 8, 2021
  3. 2/2 config: add 'config.superproject' fileEmily Shaffer, Apr 8, 2021
  4. Philip OakleyApr 9, 2021
  5. Emily ShafferApr 13, 2021
  6. Matheus Tavares BernardinoApr 9, 2021
  7. Junio C HamanoApr 9, 2021
  8. Emily ShafferApr 13, 2021
  9. Emily ShafferApr 13, 2021
  10. Future structure of submodules and .git/, .git/modules/* organizationÆvar Arnfjörð Bjarmason, Apr 14, 2021
  11. Emily ShafferApr 15, 2021
  12. Junio C HamanoApr 15, 2021
  13. 0/4 share a config between submodule and superprojectEmily Shaffer, Apr 23, 2021
  14. 1/4 config: rename "submodule" scope to "gitmodules"Emily Shaffer, Apr 23, 2021
  15. Phillip WoodApr 23, 2021
  16. 2/4 t1510-repo-setup: don't use exact matching on tracesEmily Shaffer, Apr 23, 2021
  17. Phillip WoodApr 23, 2021
  18. 3/4 t7006-pager.sh: more lenient trace checkingEmily Shaffer, Apr 23, 2021
  19. Phillip WoodApr 23, 2021
  20. Phillip WoodApr 23, 2021
  21. 4/4 config: add 'config.superproject' fileEmily Shaffer, Apr 23, 2021
  22. Johannes SchindelinApr 23, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.