diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-05-17 10:18:34 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-17 10:33:37 -0700 |
| commit | 965f8991e59d84ba1b86e528f9c27852e746fa90 (patch) | |
| tree | d0bda938d26417375738c48d67edade1a11bfce5 /builtin/submodule--helper.c | |
| parent | f1782d185b03db37412f47a013400b0693fd97bd (diff) | |
| download | git-965f8991e59d84ba1b86e528f9c27852e746fa90.tar.gz | |
refs: pass repo when retrieving submodule ref store
Looking up submodule ref stores has two deficiencies:
- The initialized subrepo will be attributed to `the_repository`.
- The submodule ref store will be tracked in a global map.
This makes it impossible to have submodule ref stores for a repository
other than `the_repository`.
Modify the function to accept the parent repository as parameter and
move the global map into `struct repository`. Like this it becomes
possible to look up submodule ref stores for arbitrary repositories.
Note that this also adds a new reference to `the_repository` in
`resolve_gitlink_ref()`, which is part of the refs interfaces. This will
get adjusted in the next patch.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
| -rw-r--r-- | builtin/submodule--helper.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index e604cb5ddb..5076a33500 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -679,7 +679,8 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, displaypath); } else if (!(flags & OPT_CACHED)) { struct object_id oid; - struct ref_store *refs = get_submodule_ref_store(path); + struct ref_store *refs = repo_get_submodule_ref_store(the_repository, + path); if (!refs) { print_status(flags, '-', path, ce_oid, displaypath); @@ -903,7 +904,8 @@ static void generate_submodule_summary(struct summary_cb *info, if (!info->cached && oideq(&p->oid_dst, null_oid())) { if (S_ISGITLINK(p->mod_dst)) { - struct ref_store *refs = get_submodule_ref_store(p->sm_path); + struct ref_store *refs = repo_get_submodule_ref_store(the_repository, + p->sm_path); if (refs) refs_head_ref(refs, handle_submodule_head_ref, &p->oid_dst); |
