Thread (94 messages) 94 messages, 5 authors, 1d ago

Re: [GSoC Patch v6 2/7] repo: add path.superproject-root with absolute and relative suffixes

From: Junio C Hamano <hidden>
Date: 2026-09-11 22:09:00

K Jayatheerth [off-list ref] writes:
Scripts working in multi-repository setups often need to identify the
top-level working tree of a superproject from within a submodule.
Currently, this is only exposed via `git rev-parse
--show-superproject-working-tree`.

Introduce `path.superproject-root.absolute` and
`path.superproject-root.relative` keys to `git repo info`.
This exposes the core submodule context via a scriptable config-like key
using standard format rules.

If requested when not inside a submodule, the command returns an empty
string.

Mentored-by: Justin Tobler [off-list ref]
Mentored-by: Lucas Seiki Oshiro [off-list ref]
Signed-off-by: K Jayatheerth <redacted>
---
 Documentation/git-repo.adoc | 10 +++++++
 builtin/repo.c              | 31 ++++++++++++++++++++
 builtin/rev-parse.c         |  2 +-
 submodule.c                 | 43 ++++++++++++++--------------
 submodule.h                 |  2 +-
 t/t1900-repo-info.sh        | 57 +++++++++++++++++++++++++++++++++++++
 6 files changed, 122 insertions(+), 23 deletions(-)
Correcting get_superproject_working_tree(), which was introduced by
bf0231c661 (rev-parse: add --show-superproject-working-tree,
2017-03-08), is a major part of this step.  The old commit added a
single test for very basic use but this step makes not-so-basic use
cases to also work correctly, right?

It may be a good idea to split this step into two patches:

 - a patch that corrects get_superproject_working_tree(), that adds
   a new test or two to t1500-rev-parse.sh, next to where bf0231c661
   (rev-parse: add --show-superproject-working-tree, 2017-03-08)
   added its test.  The test would fail without the code fix to
   demonstrate what we improved.

 - another patch that uses improved get_superproject_working_tree()
   to add path.superproject-root.* keys, together with the updates
   to t1900-repo-info.sh to add tests for the new feature.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help