diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-07-01 14:22:22 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-01 14:46:36 -0700 |
| commit | 7eafd4472d7c273e10a408da6662ca9d4b9800fd (patch) | |
| tree | bbfa21372fcbef1e66f7cb6a5c08f2c83b7ecf95 /odb.h | |
| parent | 798c661ce39f7d5297fa7ea8928ae464b6d5dd95 (diff) | |
| download | git-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.h | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -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 |
