diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-05-17 10:18:44 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-05-17 19:33:38 +0200 |
commit | dc7fb4f72c2e39ffbb98aee55ad7ea4c3f8e12fc (patch) | |
tree | ac6fe8d4aaff5edae0cf79545f9cdce1be9e8590 /repository.c | |
parent | refs: refactor `resolve_gitlink_ref()` to accept a repository (diff) | |
download | git-dc7fb4f72c2e39ffbb98aee55ad7ea4c3f8e12fc.tar.xz git-dc7fb4f72c2e39ffbb98aee55ad7ea4c3f8e12fc.zip |
refs: retrieve worktree ref stores via associated repository
Similar as with the preceding commit, the worktree ref stores are always
looked up via `the_repository`. Also, again, those ref stores are stored
in a global map.
Refactor the code so that worktrees have a pointer to their repository.
Like this, we can move the global map into `struct repository` and stop
using `the_repository`. With this change, we can now in theory look up
worktree ref stores for repositories other than `the_repository`. In
practice, the worktree code will need further changes to look up
arbitrary worktrees.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
-rw-r--r-- | repository.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/repository.c b/repository.c index bb9b9e2b52..d29b0304fb 100644 --- a/repository.c +++ b/repository.c @@ -337,6 +337,10 @@ void repo_clear(struct repository *repo) ref_store_release(e->value); strmap_clear(&repo->submodule_ref_stores, 1); + strmap_for_each_entry(&repo->worktree_ref_stores, &iter, e) + ref_store_release(e->value); + strmap_clear(&repo->worktree_ref_stores, 1); + repo_clear_path_cache(&repo->cached_paths); } |