object-file: get rid of the_repository in loose object iterators
The iterators for loose objects still rely on `the_repository`. Refactor
them:
- `for_each_loose_file_in_objdir()` is refactored so that the caller
is now expected to pass an `odb_source` as parameter instead of the
path to that source. Furthermore, it is renamed accordingly to
`for_each_loose_file_in_source()`.
- `for_each_loose_object()` is refactored to take in an object
database now and calls the above function in a loop.
This allows us to get rid of the global dependency.
Adjust callers accordingly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
83439299f1
commit
d81712ce65
@@ -4342,9 +4342,8 @@ static int add_loose_object(const struct object_id *oid, const char *path,
|
||||
*/
|
||||
static void add_unreachable_loose_objects(void)
|
||||
{
|
||||
for_each_loose_file_in_objdir(repo_get_object_directory(the_repository),
|
||||
add_loose_object,
|
||||
NULL, NULL, NULL);
|
||||
for_each_loose_file_in_source(the_repository->objects->sources,
|
||||
add_loose_object, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
|
||||
|
||||
Reference in New Issue
Block a user