Add a ref backend method for do_for_each_ref. Signed-off-by: David Turner <dturner@xxxxxxxxxxxxxxxx> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- refs.c | 8 ++++++++ refs/files-backend.c | 7 +++++-- refs/refs-internal.h | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index f4873d6..dc5682a 100644 --- a/refs.c +++ b/refs.c @@ -1342,3 +1342,11 @@ int resolve_gitlink_ref(const char *path, const char *refname, { return the_refs_backend->resolve_gitlink_ref(path, refname, sha1); } + +int do_for_each_ref(const char *submodule, const char *base, + each_ref_fn fn, int trim, int flags, + void *cb_data) +{ + return the_refs_backend->do_for_each_ref(submodule, base, fn, trim, + flags, cb_data); +} diff --git a/refs/files-backend.c b/refs/files-backend.c index 96be63c..f3d857a 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1671,8 +1671,9 @@ static int do_for_each_entry(struct ref_cache *refs, const char *base, * value, stop the iteration and return that value; otherwise, return * 0. */ -int do_for_each_ref(const char *submodule, const char *base, - each_ref_fn fn, int trim, int flags, void *cb_data) +static int files_do_for_each_ref(const char *submodule, const char *base, + each_ref_fn fn, int trim, int flags, + void *cb_data) { struct ref_entry_cb data; struct ref_cache *refs; @@ -3406,4 +3407,6 @@ struct ref_storage_be refs_be_files = { files_read_raw_ref, files_verify_refname_available, files_resolve_gitlink_ref, + + files_do_for_each_ref, }; diff --git a/refs/refs-internal.h b/refs/refs-internal.h index c5f5ef7..c9b6745 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -227,6 +227,9 @@ typedef int read_raw_ref_fn(const char *refname, unsigned char *sha1, typedef int verify_refname_available_fn(const char *refname, struct string_list *extra, struct string_list *skip, struct strbuf *err); typedef int resolve_gitlink_ref_fn(const char *path, const char *refname, unsigned char *sha1); +typedef int do_for_each_ref_fn(const char *submodule, const char *base, + each_ref_fn fn, int trim, int flags, + void *cb_data); struct ref_storage_be { struct ref_storage_be *next; @@ -240,6 +243,8 @@ struct ref_storage_be { read_raw_ref_fn *read_raw_ref; verify_refname_available_fn *verify_refname_available; resolve_gitlink_ref_fn *resolve_gitlink_ref; + + do_for_each_ref_fn *do_for_each_ref; }; extern struct ref_storage_be refs_be_files; -- 2.4.2.767.g62658d5-twtrsrc -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html