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

[RFC PATCH 0/2] share a config between submodule and superproject

From
Emily Shaffer <emilyshaffer@google.com>
Date
Apr 8, 2021, 23:39 UTC
Message-ID
<20210408233936.533342-1-emilyshaffer@google.com>
Hi folks,

Especially after es/config-based-hooks makes its way to 'next' and 'master', we think it would be really useful to have a config that applies to a whole "project" - where "project" means "superproject and its submodules." There's a longer defense in patch 2, but that's the speedy summary.

I'm not wild about the implementation of this solution as it calls out to 'git rev-parse' and 'git ls-files' - not once, but twice! - and I understand that is considerably slower on some platforms than others. But I'm open to suggestions - I couldn't find any other examples of a repo figuring out whether it's a submodule or not. (I thought there may be some, as 'repository.submodule_prefix' exists, but it seems like that's only set in some special cases during operations initated from the superproject.)

I'm hoping to work on some other submodule-centric stuff over the coming months, and it might end up being very useful to be able to tell "am I a submodule?" and "how do I talk to my superproject?" more generally - so I'm really open to figuring out a better way than this, if folks have ideas.

Patch 1 is a small refactor that we can take or leave - I found "SCOPE_SUBMODULE" to be pretty ambiguous, especially since it seems to refer to configs from .gitmodules. Even though I decided that "superproject" was a better name than "submodule" I still wasn't super happy with the ambiguity. But we can drop it if folks don't want to rename.

Thanks a bunch,
 - Emily
Emily Shaffer (2):
  config: rename "submodule" scope to "gitmodules"
  config: add 'config.superproject' file
 Documentation/git-config.txt   |  21 +++++-
 builtin/config.c               |  10 ++-
 config.c                       |  30 +++++++-
 config.h                       |   5 +-
 submodule-config.c             |   2 +-
 submodule.c                    |  29 ++++++++
 submodule.h                    |   6 ++
 t/t1311-superproject-config.sh | 124 +++++++++++++++++++++++++++++++++
 8 files changed, 220 insertions(+), 7 deletions(-)
 create mode 100755 t/t1311-superproject-config.sh
-- 
2.31.1.295.g9ea45b61b8-goog
Next: Emily Shaffer
Message 1 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.