diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-11-24 15:46:41 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-24 15:46:41 -0800 |
| commit | a545103244a712fd6a96dd2020fe91c0c8f6fdce (patch) | |
| tree | 89589f27eecd38c60e27608e2ac087c049210cc3 /repository.c | |
| parent | 05ce3ab2c6898c7694a5cc198f8b3fd931611578 (diff) | |
| parent | 3e5e360888316ed1a44da69bf134bb6ec70aee1b (diff) | |
| download | git-a545103244a712fd6a96dd2020fe91c0c8f6fdce.tar.xz | |
Merge branch 'ps/object-source-loose'
A part of code paths that deals with loose objects has been cleaned
up.
* ps/object-source-loose:
object-file: refactor writing objects via a stream
object-file: rename `write_object_file()`
object-file: refactor freshening of objects
object-file: rename `has_loose_object()`
object-file: read objects via the loose object source
object-file: move loose object map into loose source
object-file: hide internals when we need to reprepare loose sources
object-file: move loose object cache into loose source
object-file: introduce `struct odb_source_loose`
object-file: move `fetch_if_missing`
odb: adjust naming to free object sources
odb: introduce `odb_source_new()`
odb: fix subtle logic to check whether an alternate is usable
Diffstat (limited to 'repository.c')
| -rw-r--r-- | repository.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/repository.c b/repository.c index 6faf5c7398..6aaa7ba008 100644 --- a/repository.c +++ b/repository.c @@ -160,20 +160,24 @@ void repo_set_gitdir(struct repository *repo, * until after xstrdup(root). Then we can free it. */ char *old_gitdir = repo->gitdir; + char *objects_path = NULL; repo->gitdir = xstrdup(gitfile ? gitfile : root); free(old_gitdir); repo_set_commondir(repo, o->commondir); + expand_base_dir(&objects_path, o->object_dir, + repo->commondir, "objects"); if (!repo->objects->sources) { - CALLOC_ARRAY(repo->objects->sources, 1); - repo->objects->sources->odb = repo->objects; - repo->objects->sources->local = true; + repo->objects->sources = odb_source_new(repo->objects, + objects_path, true); repo->objects->sources_tail = &repo->objects->sources->next; + free(objects_path); + } else { + free(repo->objects->sources->path); + repo->objects->sources->path = objects_path; } - expand_base_dir(&repo->objects->sources->path, o->object_dir, - repo->commondir, "objects"); repo->objects->sources->disable_ref_updates = o->disable_ref_updates; |
