Re: [PATCH 13/19] object-file: get rid of `the_repository` in loose object iterators
- From
Toon Claes <toon@iotcl.com>
- Date
- Jul 10, 2025, 18:41 UTC
- Message-ID
- <875xfzdh2f.fsf@iotcl.com>
- In-Reply-To
- <20250709-pks-object-file-wo-the-repository-v1-13-62627b55707f@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 29 quoted lines
> 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> > --- > builtin/cat-file.c | 2 +- > builtin/count-objects.c | 2 +- > builtin/fsck.c | 14 ++++++++------ > builtin/gc.c | 10 ++++------ > builtin/pack-objects.c | 5 ++--- > builtin/prune.c | 2 +- > object-file.c | 18 +++++++++--------- > object-file.h | 5 +++-- > prune-packed.c | 2 +- > reachable.c | 2 +- > 10 files changed, 31 insertions(+), 31 deletions(-) >
[snip]
Show 10 quoted lines
> diff --git a/object-file.c b/object-file.c > index bd93f17dcfe..b894379d22c 100644 > --- a/object-file.c > +++ b/object-file.c > @@ -1388,7 +1388,7 @@ static int for_each_file_in_obj_subdir(unsigned int subdir_nr, > return r; > } > > -int for_each_loose_file_in_objdir(const char *path, > +int for_each_loose_file_in_source(struct odb_source *source,
I really enjoy seeing how your plan comes together here. So much nicer to not pass in the path directly.
-- Cheers, Toon