Patrick Steinhardt <ps@xxxxxx> writes: > There are a couple of functions exposed by "object.c" that implicitly > depend on `the_repository`. Remove this dependency by injecting the > repository via a parameter. Adapt callers accordingly by simply using > `the_repository`, except in cases where the subsystem is already free of > the repository. In that case, we instead pass the repository provided by > the caller's context. > > Signed-off-by: Patrick Steinhardt <ps@xxxxxx> > --- > builtin/fsck.c | 4 ++-- > builtin/grep.c | 2 +- > builtin/index-pack.c | 4 ++-- > builtin/log.c | 2 +- > builtin/name-rev.c | 4 ++-- > builtin/pack-objects.c | 2 +- > builtin/prune.c | 2 +- > midx-write.c | 4 ++-- > object.c | 21 +++++++++++---------- > object.h | 10 ++++++---- > pack-bitmap.c | 6 +++--- > reachable.c | 6 +++--- > revision.c | 3 ++- > shallow.c | 10 +++++----- > upload-pack.c | 12 ++++++------ > 15 files changed, 48 insertions(+), 44 deletions(-) > > diff --git a/builtin/fsck.c b/builtin/fsck.c > index eea1d43647f..a441eda7ff9 100644 > --- a/builtin/fsck.c > +++ b/builtin/fsck.c > @@ -399,12 +399,12 @@ static void check_connectivity(void) > } > > /* Look up all the requirements, warn about missing objects.. */ > - max = get_max_object_index(); > + max = repo_get_max_object_index(the_repository); Nit: I understand the rename here, but would be nice to callout the same in the commit message. [snip] > diff --git a/object.h b/object.h > index 17f32f1103e..0a5293e9911 100644 > --- a/object.h > +++ b/object.h > @@ -169,12 +169,13 @@ int type_from_string_gently(const char *str, ssize_t, int gentle); > /* > * Return the current number of buckets in the object hashmap. > */ > -unsigned int get_max_object_index(void); > +unsigned int repo_get_max_object_index(const struct repository *repo); > > /* > * Return the object from the specified bucket in the object hashmap. > */ > -struct object *get_indexed_object(unsigned int); > +struct object *repo_get_indexed_object(const struct repository *repo, > + unsigned int); > > /* > * This can be used to see if we have heard of the object before, but > @@ -231,7 +232,8 @@ struct object *parse_object_with_flags(struct repository *r, > * "name" parameter is not NULL, it is included in the error message > * (otherwise, the hex object ID is given). > */ > -struct object *parse_object_or_die(const struct object_id *oid, const char *name); > +struct object *parse_object_or_die(struct repository *repo, const struct object_id *oid, > + const char *name); > > /* Given the result of read_sha1_file(), returns the object after > * parsing it. eaten_p indicates if the object has a borrowed copy > @@ -336,7 +338,7 @@ void object_array_remove_duplicates(struct object_array *array); > */ > void object_array_clear(struct object_array *array); > > -void clear_object_flags(unsigned flags); > +void clear_object_flags(struct repository *repo, unsigned flags); > Could you explain the reasoning behind only renaming the first two functions with 'repo_'? > /* > * Clear the specified object flags from all in-core commit objects from [snip]
Attachment:
signature.asc
Description: PGP signature