From: Stefan Beller <sbeller@xxxxxxxxxx> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- object-store.h | 3 +-- sha1_file.c | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/object-store.h b/object-store.h index fcf36c7370..518da80367 100644 --- a/object-store.h +++ b/object-store.h @@ -68,7 +68,6 @@ extern void *map_sha1_file_the_repository(const unsigned char *sha1, unsigned lo extern void prepare_alt_odb(struct repository *r); typedef int alt_odb_fn(struct alternate_object_database *, void *); -#define foreach_alt_odb(r, fn, cb) foreach_alt_odb_##r(fn, cb) -extern int foreach_alt_odb_the_repository(alt_odb_fn, void*); +extern int foreach_alt_odb(struct repository *r, alt_odb_fn, void*); #endif /* OBJECT_STORE_H */ diff --git a/sha1_file.c b/sha1_file.c index 452c8f0bbd..81bc1ab309 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -604,18 +604,18 @@ char *compute_alternate_path(const char *path, struct strbuf *err) return ref_git; } -int foreach_alt_odb_the_repository(alt_odb_fn fn, void *cb) +int foreach_alt_odb(struct repository *r, alt_odb_fn fn, void *cb) { struct alternate_object_database *ent; - int r = 0; + int ret = 0; - prepare_alt_odb(the_repository); - for (ent = the_repository->objects.alt_odb_list; ent; ent = ent->next) { - r = fn(ent, cb); - if (r) + prepare_alt_odb(r); + for (ent = r->objects.alt_odb_list; ent; ent = ent->next) { + ret = fn(ent, cb); + if (ret) break; } - return r; + return ret; } void prepare_alt_odb(struct repository *r) -- 2.14.1.581.gf28d330327