Merge branch 'jc/refs-symref-referent'
The refs API has been taught to give symref target information to the users of ref iterators, allowing for-each-ref and friends to avoid an extra ref_resolve_* API call per a symbolic ref. * jc/refs-symref-referent: ref-filter: populate symref from iterator refs: add referent to each_ref_fn refs: keep track of unresolved reference value in iterators
This commit is contained in:
14
refs.c
14
refs.c
@ -412,7 +412,7 @@ int refs_ref_exists(struct ref_store *refs, const char *refname)
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static int for_each_filter_refs(const char *refname,
|
||||
static int for_each_filter_refs(const char *refname, const char *referent,
|
||||
const struct object_id *oid,
|
||||
int flags, void *data)
|
||||
{
|
||||
@ -422,7 +422,7 @@ static int for_each_filter_refs(const char *refname,
|
||||
return 0;
|
||||
if (filter->prefix)
|
||||
skip_prefix(refname, filter->prefix, &refname);
|
||||
return filter->fn(refname, oid, flags, filter->cb_data);
|
||||
return filter->fn(refname, referent, oid, flags, filter->cb_data);
|
||||
}
|
||||
|
||||
struct warn_if_dangling_data {
|
||||
@ -433,7 +433,7 @@ struct warn_if_dangling_data {
|
||||
const char *msg_fmt;
|
||||
};
|
||||
|
||||
static int warn_if_dangling_symref(const char *refname,
|
||||
static int warn_if_dangling_symref(const char *refname, const char *referent UNUSED,
|
||||
const struct object_id *oid UNUSED,
|
||||
int flags, void *cb_data)
|
||||
{
|
||||
@ -504,7 +504,7 @@ int refs_head_ref_namespaced(struct ref_store *refs, each_ref_fn fn, void *cb_da
|
||||
|
||||
strbuf_addf(&buf, "%sHEAD", get_git_namespace());
|
||||
if (!refs_read_ref_full(refs, buf.buf, RESOLVE_REF_READING, &oid, &flag))
|
||||
ret = fn(buf.buf, &oid, flag, cb_data);
|
||||
ret = fn(buf.buf, NULL, &oid, flag, cb_data);
|
||||
strbuf_release(&buf);
|
||||
|
||||
return ret;
|
||||
@ -1545,7 +1545,7 @@ int refs_head_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
|
||||
|
||||
if (refs_resolve_ref_unsafe(refs, "HEAD", RESOLVE_REF_READING,
|
||||
&oid, &flag))
|
||||
return fn("HEAD", &oid, flag, cb_data);
|
||||
return fn("HEAD", NULL, &oid, flag, cb_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2385,7 +2385,7 @@ struct do_for_each_reflog_help {
|
||||
void *cb_data;
|
||||
};
|
||||
|
||||
static int do_for_each_reflog_helper(const char *refname,
|
||||
static int do_for_each_reflog_helper(const char *refname, const char *referent,
|
||||
const struct object_id *oid UNUSED,
|
||||
int flags,
|
||||
void *cb_data)
|
||||
@ -2591,7 +2591,7 @@ struct migration_data {
|
||||
struct strbuf *errbuf;
|
||||
};
|
||||
|
||||
static int migrate_one_ref(const char *refname, const struct object_id *oid,
|
||||
static int migrate_one_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||
int flags, void *cb_data)
|
||||
{
|
||||
struct migration_data *data = cb_data;
|
||||
|
Reference in New Issue
Block a user