From: John Cai <johncai86@xxxxxxxxx> There is no way for callers of the refs api functions that use iterators to get a hold of a direct value of a symbolic ref before its resolved in the callback functions, as either each_ref_fn nor each_repo_ref_fn have an argument for this. This did not matter since the iterators did not hold onto the direct value of a reference anyway. But, the previous commit started to save the value of the direct reference in the iterator. Add an argument to each_repo_ref_fn that gets passed the direct value of a reference. Signed-off-by: John Cai <johncai86@xxxxxxxxx> --- builtin/replace.c | 1 + refs.c | 2 ++ refs.h | 1 + refs/iterator.c | 2 +- replace-object.c | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/builtin/replace.c b/builtin/replace.c index da59600ad22..36fa58db82c 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -48,6 +48,7 @@ struct show_data { }; static int show_reference(struct repository *r, const char *refname, + const char *referent UNUSED, const struct object_id *oid, int flag UNUSED, void *cb_data) { diff --git a/refs.c b/refs.c index b87a680249e..77ae38ea214 100644 --- a/refs.c +++ b/refs.c @@ -1664,6 +1664,7 @@ struct do_for_each_ref_help { static int do_for_each_ref_helper(struct repository *r UNUSED, const char *refname, + const char *referent, const struct object_id *oid, int flags, void *cb_data) @@ -2565,6 +2566,7 @@ struct do_for_each_reflog_help { static int do_for_each_reflog_helper(struct repository *r UNUSED, const char *refname, + const char *referent, const struct object_id *oid UNUSED, int flags, void *cb_data) diff --git a/refs.h b/refs.h index 2e740c692ac..23e5aaba2e9 100644 --- a/refs.h +++ b/refs.h @@ -311,6 +311,7 @@ typedef int each_ref_fn(const char *refname, */ typedef int each_repo_ref_fn(struct repository *r, const char *refname, + const char *referent, const struct object_id *oid, int flags, void *cb_data); diff --git a/refs/iterator.c b/refs/iterator.c index 26ca6f645ee..7e04d8427a9 100644 --- a/refs/iterator.c +++ b/refs/iterator.c @@ -449,7 +449,7 @@ int do_for_each_repo_ref_iterator(struct repository *r, struct ref_iterator *ite current_ref_iter = iter; while ((ok = ref_iterator_advance(iter)) == ITER_OK) { - retval = fn(r, iter->refname, iter->oid, iter->flags, cb_data); + retval = fn(r, iter->refname, iter->referent, iter->oid, iter->flags, cb_data); if (retval) { /* * If ref_iterator_abort() returns ITER_ERROR, diff --git a/replace-object.c b/replace-object.c index 523215589de..32d90f35327 100644 --- a/replace-object.c +++ b/replace-object.c @@ -10,6 +10,7 @@ static int register_replace_ref(struct repository *r, const char *refname, + const char *referent UNUSED, const struct object_id *oid, int flag UNUSED, void *cb_data UNUSED) -- gitgitgadget