refs: allow for_each_replace_ref to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Apr 11, 2018 at 17:21 UTC 0d296c57aec3a2c311abc5ebe7d1499bc41bc9df
2 files changed +3 -5
refs.c
+2 -2
@@ -1415,9 +1415,9 @@ int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix,
1415 return do_for_each_ref(refs, prefix, fn, 0, flag, cb_data);
1416 }
1417
1418 -int for_each_replace_ref_the_repository(each_ref_fn fn, void *cb_data)
1418 +int for_each_replace_ref(struct repository *r, each_ref_fn fn, void *cb_data)
1419 {
1420 - return do_for_each_ref(get_main_ref_store(the_repository),
1420 + return do_for_each_ref(get_main_ref_store(r),
1421 git_replace_ref_base, fn,
1422 strlen(git_replace_ref_base),
1423 DO_FOR_EACH_INCLUDE_BROKEN, cb_data);
refs.h
+1 -3
@@ -300,9 +300,7 @@ int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data,
300 int for_each_tag_ref(each_ref_fn fn, void *cb_data);
301 int for_each_branch_ref(each_ref_fn fn, void *cb_data);
302 int for_each_remote_ref(each_ref_fn fn, void *cb_data);
303 -#define for_each_replace_ref(r, fn, cb) \
304 - for_each_replace_ref_##r(fn, cb)
305 -int for_each_replace_ref_the_repository(each_ref_fn fn, void *cb_data);
303 +int for_each_replace_ref(struct repository *r, each_ref_fn fn, void *cb_data);
304 int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data);
305 int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
306 const char *prefix, void *cb_data);