aboutsummaryrefslogtreecommitdiff
path: root/odb.h
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 /odb.h
parent798c661ce39f7d5297fa7ea8928ae464b6d5dd95 (diff)
downloadgit-7eafd4472d7c273e10a408da6662ca9d4b9800fd.tar.xz
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 'odb.h')
-rw-r--r--odb.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/odb.h b/odb.h
index 7e65e9707c..4e2d1004f8 100644
--- a/odb.h
+++ b/odb.h
@@ -73,17 +73,6 @@ struct odb_source {
char *path;
};
-/*
- * Replace the current writable object directory with the specified temporary
- * object directory; returns the former primary object directory.
- */
-struct odb_source *set_temporary_primary_odb(const char *dir, int will_destroy);
-
-/*
- * Restore a previous ODB replaced by set_temporary_main_odb.
- */
-void restore_primary_odb(struct odb_source *restore_alternate, const char *old_path);
-
struct packed_git;
struct multi_pack_index;
struct cached_object_entry;
@@ -188,6 +177,21 @@ void odb_clear(struct object_database *o);
struct odb_source *odb_find_source(struct object_database *odb, const char *obj_dir);
/*
+ * Replace the current writable object directory with the specified temporary
+ * object directory; returns the former primary source.
+ */
+struct odb_source *odb_set_temporary_primary_source(struct object_database *odb,
+ const char *dir, int will_destroy);
+
+/*
+ * Restore the primary source that was previously replaced by
+ * `odb_set_temporary_primary_source()`.
+ */
+void odb_restore_primary_source(struct object_database *odb,
+ struct odb_source *restore_source,
+ const char *old_path);
+
+/*
* Iterate through all alternates of the database and execute the provided
* callback function for each of them. Stop iterating once the callback
* function returns a non-zero value, in which case the value is bubbled up