Add a ref backend method for do_for_each_ref. Signed-off-by: David Turner <dturner@xxxxxxxxxxxxxxxx> --- 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 bfe3b4e..253e566 100644 --- a/refs.c +++ b/refs.c @@ -1233,3 +1233,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 dec8575..34c414b 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1735,8 +1735,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; @@ -3471,4 +3472,6 @@ struct ref_storage_be refs_be_files = { files_resolve_ref_unsafe, 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 ed458fb..1caeb61 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -224,6 +224,9 @@ typedef const char *resolve_ref_unsafe_fn(const char *ref, 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; @@ -237,6 +240,8 @@ struct ref_storage_be { resolve_ref_unsafe_fn *resolve_ref_unsafe; 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