aboutsummaryrefslogtreecommitdiffstats
path: root/tmp-objdir.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-01 14:22:22 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-01 14:46:36 -0700
commit7eafd4472d7c273e10a408da6662ca9d4b9800fd (patch)
treebbfa21372fcbef1e66f7cb6a5c08f2c83b7ecf95 /tmp-objdir.c
parent798c661ce39f7d5297fa7ea8928ae464b6d5dd95 (diff)
downloadgit-7eafd4472d7c273e10a408da6662ca9d4b9800fd.tar.gz
odb: get rid of `the_repository` when handling the primary source
The functions `set_temporary_primary_odb()` and `restore_primary_odb()` are responsible for managing a temporary primary source for the database. Both of these functions implicitly rely on `the_repository`. Refactor them to instead take an explicit object database parameter as argument and adjust callers. Rename the functions accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tmp-objdir.c')
-rw-r--r--tmp-objdir.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tmp-objdir.c b/tmp-objdir.c
index 4120badf5c..ae01eae9c4 100644
--- a/tmp-objdir.c
+++ b/tmp-objdir.c
@@ -47,7 +47,7 @@ int tmp_objdir_destroy(struct tmp_objdir *t)
the_tmp_objdir = NULL;
if (t->prev_source)
- restore_primary_odb(t->prev_source, t->path.buf);
+ odb_restore_primary_source(t->repo->objects, t->prev_source, t->path.buf);
err = remove_dir_recursively(&t->path, 0);
@@ -279,7 +279,7 @@ int tmp_objdir_migrate(struct tmp_objdir *t)
if (t->prev_source) {
if (t->repo->objects->sources->will_destroy)
BUG("migrating an ODB that was marked for destruction");
- restore_primary_odb(t->prev_source, t->path.buf);
+ odb_restore_primary_source(t->repo->objects, t->prev_source, t->path.buf);
t->prev_source = NULL;
}
@@ -311,7 +311,8 @@ void tmp_objdir_replace_primary_odb(struct tmp_objdir *t, int will_destroy)
{
if (t->prev_source)
BUG("the primary object database is already replaced");
- t->prev_source = set_temporary_primary_odb(t->path.buf, will_destroy);
+ t->prev_source = odb_set_temporary_primary_source(t->repo->objects,
+ t->path.buf, will_destroy);
t->will_destroy = will_destroy;
}
@@ -320,7 +321,8 @@ struct tmp_objdir *tmp_objdir_unapply_primary_odb(void)
if (!the_tmp_objdir || !the_tmp_objdir->prev_source)
return NULL;
- restore_primary_odb(the_tmp_objdir->prev_source, the_tmp_objdir->path.buf);
+ odb_restore_primary_source(the_tmp_objdir->repo->objects,
+ the_tmp_objdir->prev_source, the_tmp_objdir->path.buf);
the_tmp_objdir->prev_source = NULL;
return the_tmp_objdir;
}