mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'ps/refs-without-the-repository-updates'
Further clean-up the refs subsystem to stop relying on the_repository, and instead use the repository associated to the ref_store object. * ps/refs-without-the-repository-updates: refs/packed: remove references to `the_hash_algo` refs/files: remove references to `the_hash_algo` refs/files: use correct repository refs: remove `dwim_log()` refs: drop `git_default_branch_name()` refs: pass repo when peeling objects refs: move object peeling into "object.c" refs: pass ref store when detecting dangling symrefs refs: convert iteration over replace refs to accept ref store refs: retrieve worktree ref stores via associated repository refs: refactor `resolve_gitlink_ref()` to accept a repository refs: pass repo when retrieving submodule ref store refs: track ref stores via strmap refs: implement releasing ref storages refs: rename `init_db` callback to avoid confusion refs: adjust names for `init` and `init_db` callbacks
This commit is contained in:
12
repository.c
12
repository.c
@@ -14,6 +14,7 @@
|
||||
#include "sparse-index.h"
|
||||
#include "trace2.h"
|
||||
#include "promisor-remote.h"
|
||||
#include "refs.h"
|
||||
|
||||
/* The main repository */
|
||||
static struct repository the_repo;
|
||||
@@ -269,6 +270,9 @@ static void repo_clear_path_cache(struct repo_path_cache *cache)
|
||||
|
||||
void repo_clear(struct repository *repo)
|
||||
{
|
||||
struct hashmap_iter iter;
|
||||
struct strmap_entry *e;
|
||||
|
||||
FREE_AND_NULL(repo->gitdir);
|
||||
FREE_AND_NULL(repo->commondir);
|
||||
FREE_AND_NULL(repo->graft_file);
|
||||
@@ -309,6 +313,14 @@ void repo_clear(struct repository *repo)
|
||||
FREE_AND_NULL(repo->remote_state);
|
||||
}
|
||||
|
||||
strmap_for_each_entry(&repo->submodule_ref_stores, &iter, e)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user