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:
commit
e7f86cb69d
3
bisect.c
3
bisect.c
@ -448,7 +448,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
|
|||||||
clear_commit_weight(&commit_weight);
|
clear_commit_weight(&commit_weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int register_ref(const char *refname, const struct object_id *oid,
|
static int register_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flags UNUSED, void *cb_data UNUSED)
|
int flags UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
struct strbuf good_prefix = STRBUF_INIT;
|
struct strbuf good_prefix = STRBUF_INIT;
|
||||||
@ -1170,6 +1170,7 @@ int estimate_bisect_steps(int all)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mark_for_removal(const char *refname,
|
static int mark_for_removal(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flag UNUSED, void *cb_data)
|
int flag UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -356,6 +356,7 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int inc_nr(const char *refname UNUSED,
|
static int inc_nr(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flag UNUSED, void *cb_data)
|
int flag UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
@ -545,7 +546,7 @@ static int bisect_append_log_quoted(const char **argv)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_bisect_ref(const char *refname, const struct object_id *oid,
|
static int add_bisect_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flags UNUSED, void *cb)
|
int flags UNUSED, void *cb)
|
||||||
{
|
{
|
||||||
struct add_bisect_ref_data *data = cb;
|
struct add_bisect_ref_data *data = cb;
|
||||||
@ -1162,6 +1163,7 @@ static int bisect_visualize(struct bisect_terms *terms, int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int get_first_good(const char *refname UNUSED,
|
static int get_first_good(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data)
|
int flag UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -1045,7 +1045,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
|
|||||||
report_tracking(new_branch_info);
|
report_tracking(new_branch_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_pending_uninteresting_ref(const char *refname,
|
static int add_pending_uninteresting_ref(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED, void *cb_data)
|
int flags UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ static void add_to_known_names(const char *path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_name(const char *path, const struct object_id *oid,
|
static int get_name(const char *path, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
int is_tag = 0;
|
int is_tag = 0;
|
||||||
|
@ -286,7 +286,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
|
|||||||
return ent;
|
return ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_one_refname(const char *refname,
|
static int add_one_refname(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED, void *cbdata)
|
int flag UNUSED, void *cbdata)
|
||||||
{
|
{
|
||||||
@ -1464,6 +1464,7 @@ static void set_option(struct transport *transport, const char *name, const char
|
|||||||
|
|
||||||
|
|
||||||
static int add_oid(const char *refname UNUSED,
|
static int add_oid(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED, void *cb_data)
|
int flags UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -521,7 +521,7 @@ static int fsck_handle_reflog(const char *logname, void *cb_data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fsck_handle_ref(const char *refname, const struct object_id *oid,
|
static int fsck_handle_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
struct object *obj;
|
struct object *obj;
|
||||||
@ -576,7 +576,7 @@ static void get_default_heads(void)
|
|||||||
strbuf_worktree_ref(wt, &ref, "HEAD");
|
strbuf_worktree_ref(wt, &ref, "HEAD");
|
||||||
fsck_head_link(ref.buf, &head_points_at, &head_oid);
|
fsck_head_link(ref.buf, &head_points_at, &head_oid);
|
||||||
if (head_points_at && !is_null_oid(&head_oid))
|
if (head_points_at && !is_null_oid(&head_oid))
|
||||||
fsck_handle_ref(ref.buf, &head_oid, 0, NULL);
|
fsck_handle_ref(ref.buf, NULL, &head_oid, 0, NULL);
|
||||||
strbuf_release(&ref);
|
strbuf_release(&ref);
|
||||||
|
|
||||||
if (include_reflogs)
|
if (include_reflogs)
|
||||||
|
@ -836,6 +836,7 @@ struct cg_auto_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int dfs_on_ref(const char *refname UNUSED,
|
static int dfs_on_ref(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
|
@ -337,7 +337,7 @@ static int cmp_by_tag_and_age(const void *a_, const void *b_)
|
|||||||
return a->taggerdate != b->taggerdate;
|
return a->taggerdate != b->taggerdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int name_ref(const char *path, const struct object_id *oid,
|
static int name_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flags UNUSED, void *cb_data)
|
int flags UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
struct object *o = parse_object(the_repository, oid);
|
struct object *o = parse_object(the_repository, oid);
|
||||||
|
@ -771,7 +771,7 @@ static enum write_one_status write_one(struct hashfile *f,
|
|||||||
return WRITE_ONE_WRITTEN;
|
return WRITE_ONE_WRITTEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mark_tagged(const char *path UNUSED, const struct object_id *oid,
|
static int mark_tagged(const char *path UNUSED, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
struct object_id peeled;
|
struct object_id peeled;
|
||||||
@ -3129,7 +3129,7 @@ static void add_tag_chain(const struct object_id *oid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_ref_tag(const char *tag UNUSED, const struct object_id *oid,
|
static int add_ref_tag(const char *tag UNUSED, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
struct object_id peeled;
|
struct object_id peeled;
|
||||||
@ -4076,6 +4076,7 @@ static void record_recent_commit(struct commit *commit, void *data UNUSED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mark_bitmap_preferred_tip(const char *refname,
|
static int mark_bitmap_preferred_tip(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *data UNUSED)
|
void *data UNUSED)
|
||||||
|
@ -300,7 +300,7 @@ static void show_ref(const char *path, const struct object_id *oid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_ref_cb(const char *path_full, const struct object_id *oid,
|
static int show_ref_cb(const char *path_full, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *data)
|
int flag UNUSED, void *data)
|
||||||
{
|
{
|
||||||
struct oidset *seen = data;
|
struct oidset *seen = data;
|
||||||
|
@ -544,6 +544,7 @@ struct branches_for_remote {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int add_branch_for_removal(const char *refname,
|
static int add_branch_for_removal(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flags UNUSED, void *cb_data)
|
int flags UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
@ -589,7 +590,7 @@ struct rename_info {
|
|||||||
uint32_t symrefs_nr;
|
uint32_t symrefs_nr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int read_remote_branches(const char *refname,
|
static int read_remote_branches(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flags UNUSED, void *cb_data)
|
int flags UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
@ -995,6 +996,7 @@ static void free_remote_ref_states(struct ref_states *states)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int append_ref_to_tracked_list(const char *refname,
|
static int append_ref_to_tracked_list(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flags, void *cb_data)
|
int flags, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -667,6 +667,7 @@ struct midx_snapshot_ref_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int midx_snapshot_ref_one(const char *refname UNUSED,
|
static int midx_snapshot_ref_one(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED, void *_data)
|
int flag UNUSED, void *_data)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@ struct show_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int show_reference(const char *refname,
|
static int show_reference(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data)
|
int flag UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -211,7 +211,7 @@ static int show_default(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_reference(const char *refname, const struct object_id *oid,
|
static int show_reference(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
if (ref_excluded(&ref_excludes, refname))
|
if (ref_excluded(&ref_excludes, refname))
|
||||||
@ -220,7 +220,7 @@ static int show_reference(const char *refname, const struct object_id *oid,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int anti_reference(const char *refname, const struct object_id *oid,
|
static int anti_reference(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
show_rev(REVERSED, oid, refname);
|
show_rev(REVERSED, oid, refname);
|
||||||
|
@ -410,7 +410,7 @@ static int append_ref(const char *refname, const struct object_id *oid,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int append_head_ref(const char *refname, const struct object_id *oid,
|
static int append_head_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
struct object_id tmp;
|
struct object_id tmp;
|
||||||
@ -425,7 +425,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,
|
|||||||
return append_ref(refname + ofs, oid, 0);
|
return append_ref(refname + ofs, oid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int append_remote_ref(const char *refname, const struct object_id *oid,
|
static int append_remote_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data UNUSED)
|
int flag UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
struct object_id tmp;
|
struct object_id tmp;
|
||||||
@ -451,7 +451,7 @@ static int append_tag_ref(const char *refname, const struct object_id *oid,
|
|||||||
static const char *match_ref_pattern = NULL;
|
static const char *match_ref_pattern = NULL;
|
||||||
static int match_ref_slash = 0;
|
static int match_ref_slash = 0;
|
||||||
|
|
||||||
static int append_matching_ref(const char *refname, const struct object_id *oid,
|
static int append_matching_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
/* we want to allow pattern hold/<asterisk> to show all
|
/* we want to allow pattern hold/<asterisk> to show all
|
||||||
@ -468,7 +468,7 @@ static int append_matching_ref(const char *refname, const struct object_id *oid,
|
|||||||
if (wildmatch(match_ref_pattern, tail, 0))
|
if (wildmatch(match_ref_pattern, tail, 0))
|
||||||
return 0;
|
return 0;
|
||||||
if (starts_with(refname, "refs/heads/"))
|
if (starts_with(refname, "refs/heads/"))
|
||||||
return append_head_ref(refname, oid, flag, cb_data);
|
return append_head_ref(refname, NULL, oid, flag, cb_data);
|
||||||
if (starts_with(refname, "refs/tags/"))
|
if (starts_with(refname, "refs/tags/"))
|
||||||
return append_tag_ref(refname, oid, flag, cb_data);
|
return append_tag_ref(refname, oid, flag, cb_data);
|
||||||
return append_ref(refname, oid, 0);
|
return append_ref(refname, oid, 0);
|
||||||
|
@ -63,7 +63,7 @@ struct show_ref_data {
|
|||||||
int show_head;
|
int show_head;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int show_ref(const char *refname, const struct object_id *oid,
|
static int show_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cbdata)
|
int flag UNUSED, void *cbdata)
|
||||||
{
|
{
|
||||||
struct show_ref_data *data = cbdata;
|
struct show_ref_data *data = cbdata;
|
||||||
@ -97,6 +97,7 @@ static int show_ref(const char *refname, const struct object_id *oid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int add_existing(const char *refname,
|
static int add_existing(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flag UNUSED, void *cbdata)
|
int flag UNUSED, void *cbdata)
|
||||||
{
|
{
|
||||||
|
@ -608,6 +608,7 @@ static void print_status(unsigned int flags, char state, const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int handle_submodule_head_ref(const char *refname UNUSED,
|
static int handle_submodule_head_ref(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
|
@ -626,6 +626,7 @@ static void print_preparing_worktree_line(int detach,
|
|||||||
* Returns 0 on failure and non-zero on success.
|
* Returns 0 on failure and non-zero on success.
|
||||||
*/
|
*/
|
||||||
static int first_valid_ref(const char *refname UNUSED,
|
static int first_valid_ref(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *cb_data UNUSED)
|
void *cb_data UNUSED)
|
||||||
|
@ -1847,6 +1847,7 @@ struct refs_cb_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int add_ref_to_set(const char *refname UNUSED,
|
static int add_ref_to_set(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED, void *cb_data)
|
int flags UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -390,7 +390,7 @@ static void add_ref_to_island(kh_str_t *remote_islands, const char *island_name,
|
|||||||
rl->hash += sha_core;
|
rl->hash += sha_core;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_island_for_ref(const char *refname, const struct object_id *oid,
|
static int find_island_for_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flags UNUSED, void *cb)
|
int flags UNUSED, void *cb)
|
||||||
{
|
{
|
||||||
struct island_load_data *ild = cb;
|
struct island_load_data *ild = cb;
|
||||||
|
@ -183,6 +183,7 @@ static int rev_list_insert_ref(struct fetch_negotiator *negotiator,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int rev_list_insert_ref_oid(const char *refname UNUSED,
|
static int rev_list_insert_ref_oid(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
@ -610,6 +611,7 @@ static int mark_complete(const struct object_id *oid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mark_complete_oid(const char *refname UNUSED,
|
static int mark_complete_oid(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data UNUSED)
|
void *cb_data UNUSED)
|
||||||
|
2
help.c
2
help.c
@ -804,7 +804,7 @@ struct similar_ref_cb {
|
|||||||
struct string_list *similar_refs;
|
struct string_list *similar_refs;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int append_similar_ref(const char *refname,
|
static int append_similar_ref(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flags UNUSED, void *cb_data)
|
int flags UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -512,7 +512,7 @@ static void run_service(const char **argv, int buffer_input)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_text_ref(const char *name, const struct object_id *oid,
|
static int show_text_ref(const char *name, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data)
|
int flag UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
const char *name_nons = strip_namespace(name);
|
const char *name_nons = strip_namespace(name);
|
||||||
@ -568,7 +568,7 @@ static void get_info_refs(struct strbuf *hdr, char *arg UNUSED)
|
|||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_head_ref(const char *refname, const struct object_id *oid,
|
static int show_head_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
struct strbuf *buf = cb_data;
|
struct strbuf *buf = cb_data;
|
||||||
|
@ -146,7 +146,7 @@ static int ref_filter_match(const char *refname,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_ref_decoration(const char *refname, const struct object_id *oid,
|
static int add_ref_decoration(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ struct ls_refs_data {
|
|||||||
unsigned unborn : 1;
|
unsigned unborn : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int send_ref(const char *refname, const struct object_id *oid,
|
static int send_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
struct ls_refs_data *data = cb_data;
|
struct ls_refs_data *data = cb_data;
|
||||||
@ -135,7 +135,7 @@ static void send_possibly_unborn_head(struct ls_refs_data *data)
|
|||||||
oid_is_null = is_null_oid(&oid);
|
oid_is_null = is_null_oid(&oid);
|
||||||
if (!oid_is_null ||
|
if (!oid_is_null ||
|
||||||
(data->unborn && data->symrefs && (flag & REF_ISSYMREF)))
|
(data->unborn && data->symrefs && (flag & REF_ISSYMREF)))
|
||||||
send_ref(namespaced.buf, oid_is_null ? NULL : &oid, flag, data);
|
send_ref(namespaced.buf, NULL, oid_is_null ? NULL : &oid, flag, data);
|
||||||
strbuf_release(&namespaced);
|
strbuf_release(&namespaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +655,7 @@ static void prepare_midx_packing_data(struct packing_data *pdata,
|
|||||||
trace2_region_leave("midx", "prepare_midx_packing_data", the_repository);
|
trace2_region_leave("midx", "prepare_midx_packing_data", the_repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_ref_to_pending(const char *refname,
|
static int add_ref_to_pending(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ static void rev_list_push(struct negotiation_state *ns,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clear_marks(const char *refname, const struct object_id *oid,
|
static int clear_marks(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data UNUSED)
|
void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ static struct entry *rev_list_push(struct data *data, struct commit *commit, int
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clear_marks(const char *refname, const struct object_id *oid,
|
static int clear_marks(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data UNUSED)
|
void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
|
2
notes.c
2
notes.c
@ -932,7 +932,7 @@ int combine_notes_cat_sort_uniq(struct object_id *cur_oid,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int string_list_add_one_ref(const char *refname,
|
static int string_list_add_one_ref(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flag UNUSED, void *cb)
|
int flag UNUSED, void *cb)
|
||||||
{
|
{
|
||||||
|
@ -1368,7 +1368,7 @@ struct handle_one_ref_cb {
|
|||||||
struct commit_list **list;
|
struct commit_list **list;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int handle_one_ref(const char *path, const struct object_id *oid,
|
static int handle_one_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -201,6 +201,7 @@ void load_pseudo_merges_from_config(struct string_list *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int find_pseudo_merge_group_for_ref(const char *refname,
|
static int find_pseudo_merge_group_for_ref(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *_data)
|
void *_data)
|
||||||
|
@ -79,7 +79,7 @@ static void add_rebase_files(struct rev_info *revs)
|
|||||||
free_worktrees(worktrees);
|
free_worktrees(worktrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_one_ref(const char *path, const struct object_id *oid,
|
static int add_one_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
struct rev_info *revs = (struct rev_info *)cb_data;
|
struct rev_info *revs = (struct rev_info *)cb_data;
|
||||||
|
17
ref-filter.c
17
ref-filter.c
@ -2344,6 +2344,12 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
|
|||||||
|
|
||||||
CALLOC_ARRAY(ref->value, used_atom_cnt);
|
CALLOC_ARRAY(ref->value, used_atom_cnt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NEEDSWORK: The following code might be unncessary if all codepaths
|
||||||
|
* that call populate_value() populates the symref member of ref_array_item
|
||||||
|
* like in apply_ref_filter(). Currently pretty_print_ref() is the only codepath
|
||||||
|
* that calls populate_value() without first populating symref.
|
||||||
|
*/
|
||||||
if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
|
if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
|
||||||
ref->symref = refs_resolve_refdup(get_main_ref_store(the_repository),
|
ref->symref = refs_resolve_refdup(get_main_ref_store(the_repository),
|
||||||
ref->refname,
|
ref->refname,
|
||||||
@ -2784,7 +2790,7 @@ static int filter_ref_kind(struct ref_filter *filter, const char *refname)
|
|||||||
return ref_kind_from_refname(refname);
|
return ref_kind_from_refname(refname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ref_array_item *apply_ref_filter(const char *refname, const struct object_id *oid,
|
static struct ref_array_item *apply_ref_filter(const char *refname, const char *referent, const struct object_id *oid,
|
||||||
int flag, struct ref_filter *filter)
|
int flag, struct ref_filter *filter)
|
||||||
{
|
{
|
||||||
struct ref_array_item *ref;
|
struct ref_array_item *ref;
|
||||||
@ -2853,6 +2859,7 @@ static struct ref_array_item *apply_ref_filter(const char *refname, const struct
|
|||||||
ref->commit = commit;
|
ref->commit = commit;
|
||||||
ref->flag = flag;
|
ref->flag = flag;
|
||||||
ref->kind = kind;
|
ref->kind = kind;
|
||||||
|
ref->symref = xstrdup_or_null(referent);
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
@ -2866,12 +2873,12 @@ struct ref_filter_cbdata {
|
|||||||
* A call-back given to for_each_ref(). Filter refs and keep them for
|
* A call-back given to for_each_ref(). Filter refs and keep them for
|
||||||
* later object processing.
|
* later object processing.
|
||||||
*/
|
*/
|
||||||
static int filter_one(const char *refname, const struct object_id *oid, int flag, void *cb_data)
|
static int filter_one(const char *refname, const char *referent, const struct object_id *oid, int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
struct ref_filter_cbdata *ref_cbdata = cb_data;
|
struct ref_filter_cbdata *ref_cbdata = cb_data;
|
||||||
struct ref_array_item *ref;
|
struct ref_array_item *ref;
|
||||||
|
|
||||||
ref = apply_ref_filter(refname, oid, flag, ref_cbdata->filter);
|
ref = apply_ref_filter(refname, referent, oid, flag, ref_cbdata->filter);
|
||||||
if (ref)
|
if (ref)
|
||||||
ref_array_append(ref_cbdata->array, ref);
|
ref_array_append(ref_cbdata->array, ref);
|
||||||
|
|
||||||
@ -2901,13 +2908,13 @@ struct ref_filter_and_format_cbdata {
|
|||||||
} internal;
|
} internal;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int filter_and_format_one(const char *refname, const struct object_id *oid, int flag, void *cb_data)
|
static int filter_and_format_one(const char *refname, const char *referent, const struct object_id *oid, int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
struct ref_filter_and_format_cbdata *ref_cbdata = cb_data;
|
struct ref_filter_and_format_cbdata *ref_cbdata = cb_data;
|
||||||
struct ref_array_item *ref;
|
struct ref_array_item *ref;
|
||||||
struct strbuf output = STRBUF_INIT, err = STRBUF_INIT;
|
struct strbuf output = STRBUF_INIT, err = STRBUF_INIT;
|
||||||
|
|
||||||
ref = apply_ref_filter(refname, oid, flag, ref_cbdata->filter);
|
ref = apply_ref_filter(refname, referent, oid, flag, ref_cbdata->filter);
|
||||||
if (!ref)
|
if (!ref)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
1
reflog.c
1
reflog.c
@ -300,6 +300,7 @@ int should_expire_reflog_ent_verbose(struct object_id *ooid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int push_tip_to_list(const char *refname UNUSED,
|
static int push_tip_to_list(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags, void *cb_data)
|
int flags, void *cb_data)
|
||||||
{
|
{
|
||||||
|
14
refs.c
14
refs.c
@ -412,7 +412,7 @@ int refs_ref_exists(struct ref_store *refs, const char *refname)
|
|||||||
NULL, NULL);
|
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,
|
const struct object_id *oid,
|
||||||
int flags, void *data)
|
int flags, void *data)
|
||||||
{
|
{
|
||||||
@ -422,7 +422,7 @@ static int for_each_filter_refs(const char *refname,
|
|||||||
return 0;
|
return 0;
|
||||||
if (filter->prefix)
|
if (filter->prefix)
|
||||||
skip_prefix(refname, filter->prefix, &refname);
|
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 {
|
struct warn_if_dangling_data {
|
||||||
@ -433,7 +433,7 @@ struct warn_if_dangling_data {
|
|||||||
const char *msg_fmt;
|
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,
|
const struct object_id *oid UNUSED,
|
||||||
int flags, void *cb_data)
|
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());
|
strbuf_addf(&buf, "%sHEAD", get_git_namespace());
|
||||||
if (!refs_read_ref_full(refs, buf.buf, RESOLVE_REF_READING, &oid, &flag))
|
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);
|
strbuf_release(&buf);
|
||||||
|
|
||||||
return ret;
|
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,
|
if (refs_resolve_ref_unsafe(refs, "HEAD", RESOLVE_REF_READING,
|
||||||
&oid, &flag))
|
&oid, &flag))
|
||||||
return fn("HEAD", &oid, flag, cb_data);
|
return fn("HEAD", NULL, &oid, flag, cb_data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2385,7 +2385,7 @@ struct do_for_each_reflog_help {
|
|||||||
void *cb_data;
|
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,
|
const struct object_id *oid UNUSED,
|
||||||
int flags,
|
int flags,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
@ -2591,7 +2591,7 @@ struct migration_data {
|
|||||||
struct strbuf *errbuf;
|
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)
|
int flags, void *cb_data)
|
||||||
{
|
{
|
||||||
struct migration_data *data = cb_data;
|
struct migration_data *data = cb_data;
|
||||||
|
2
refs.h
2
refs.h
@ -298,7 +298,7 @@ struct ref_transaction;
|
|||||||
* arguments is only guaranteed to be valid for the duration of a
|
* arguments is only guaranteed to be valid for the duration of a
|
||||||
* single callback invocation.
|
* single callback invocation.
|
||||||
*/
|
*/
|
||||||
typedef int each_ref_fn(const char *refname,
|
typedef int each_ref_fn(const char *refname, const char *referent,
|
||||||
const struct object_id *oid, int flags, void *cb_data);
|
const struct object_id *oid, int flags, void *cb_data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -244,9 +244,12 @@ static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs,
|
|||||||
{
|
{
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
int flag;
|
int flag;
|
||||||
|
const char *referent = refs_resolve_ref_unsafe(&refs->base,
|
||||||
|
refname,
|
||||||
|
RESOLVE_REF_READING,
|
||||||
|
&oid, &flag);
|
||||||
|
|
||||||
if (!refs_resolve_ref_unsafe(&refs->base, refname, RESOLVE_REF_READING,
|
if (!referent) {
|
||||||
&oid, &flag)) {
|
|
||||||
oidclr(&oid, refs->base.repo->hash_algo);
|
oidclr(&oid, refs->base.repo->hash_algo);
|
||||||
flag |= REF_ISBROKEN;
|
flag |= REF_ISBROKEN;
|
||||||
} else if (is_null_oid(&oid)) {
|
} else if (is_null_oid(&oid)) {
|
||||||
@ -267,7 +270,11 @@ static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs,
|
|||||||
oidclr(&oid, refs->base.repo->hash_algo);
|
oidclr(&oid, refs->base.repo->hash_algo);
|
||||||
flag |= REF_BAD_NAME | REF_ISBROKEN;
|
flag |= REF_BAD_NAME | REF_ISBROKEN;
|
||||||
}
|
}
|
||||||
add_entry_to_dir(dir, create_ref_entry(refname, &oid, flag));
|
|
||||||
|
if (!(flag & REF_ISSYMREF))
|
||||||
|
referent = NULL;
|
||||||
|
|
||||||
|
add_entry_to_dir(dir, create_ref_entry(refname, referent, &oid, flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -887,6 +894,8 @@ static int files_ref_iterator_advance(struct ref_iterator *ref_iterator)
|
|||||||
iter->base.refname = iter->iter0->refname;
|
iter->base.refname = iter->iter0->refname;
|
||||||
iter->base.oid = iter->iter0->oid;
|
iter->base.oid = iter->iter0->oid;
|
||||||
iter->base.flags = iter->iter0->flags;
|
iter->base.flags = iter->iter0->flags;
|
||||||
|
iter->base.referent = iter->iter0->referent;
|
||||||
|
|
||||||
return ITER_OK;
|
return ITER_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3037,7 +3046,7 @@ static int files_transaction_abort(struct ref_store *ref_store,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ref_present(const char *refname,
|
static int ref_present(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
|
@ -29,6 +29,7 @@ void base_ref_iterator_init(struct ref_iterator *iter,
|
|||||||
{
|
{
|
||||||
iter->vtable = vtable;
|
iter->vtable = vtable;
|
||||||
iter->refname = NULL;
|
iter->refname = NULL;
|
||||||
|
iter->referent = NULL;
|
||||||
iter->oid = NULL;
|
iter->oid = NULL;
|
||||||
iter->flags = 0;
|
iter->flags = 0;
|
||||||
}
|
}
|
||||||
@ -199,6 +200,7 @@ static int merge_ref_iterator_advance(struct ref_iterator *ref_iterator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selection & ITER_YIELD_CURRENT) {
|
if (selection & ITER_YIELD_CURRENT) {
|
||||||
|
iter->base.referent = (*iter->current)->referent;
|
||||||
iter->base.refname = (*iter->current)->refname;
|
iter->base.refname = (*iter->current)->refname;
|
||||||
iter->base.oid = (*iter->current)->oid;
|
iter->base.oid = (*iter->current)->oid;
|
||||||
iter->base.flags = (*iter->current)->flags;
|
iter->base.flags = (*iter->current)->flags;
|
||||||
@ -448,7 +450,7 @@ int do_for_each_ref_iterator(struct ref_iterator *iter,
|
|||||||
|
|
||||||
current_ref_iter = iter;
|
current_ref_iter = iter;
|
||||||
while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
|
while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
|
||||||
retval = fn(iter->refname, iter->oid, iter->flags, cb_data);
|
retval = fn(iter->refname, iter->referent, iter->oid, iter->flags, cb_data);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
/*
|
/*
|
||||||
* If ref_iterator_abort() returns ITER_ERROR,
|
* If ref_iterator_abort() returns ITER_ERROR,
|
||||||
|
@ -34,6 +34,7 @@ struct ref_dir *get_ref_dir(struct ref_entry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ref_entry *create_ref_entry(const char *refname,
|
struct ref_entry *create_ref_entry(const char *refname,
|
||||||
|
const char *referent,
|
||||||
const struct object_id *oid, int flag)
|
const struct object_id *oid, int flag)
|
||||||
{
|
{
|
||||||
struct ref_entry *ref;
|
struct ref_entry *ref;
|
||||||
@ -41,6 +42,8 @@ struct ref_entry *create_ref_entry(const char *refname,
|
|||||||
FLEX_ALLOC_STR(ref, name, refname);
|
FLEX_ALLOC_STR(ref, name, refname);
|
||||||
oidcpy(&ref->u.value.oid, oid);
|
oidcpy(&ref->u.value.oid, oid);
|
||||||
ref->flag = flag;
|
ref->flag = flag;
|
||||||
|
ref->u.value.referent = xstrdup_or_null(referent);
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +69,7 @@ static void free_ref_entry(struct ref_entry *entry)
|
|||||||
*/
|
*/
|
||||||
clear_ref_dir(&entry->u.subdir);
|
clear_ref_dir(&entry->u.subdir);
|
||||||
}
|
}
|
||||||
|
free(entry->u.value.referent);
|
||||||
free(entry);
|
free(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +435,7 @@ static int cache_ref_iterator_advance(struct ref_iterator *ref_iterator)
|
|||||||
level->index = -1;
|
level->index = -1;
|
||||||
} else {
|
} else {
|
||||||
iter->base.refname = entry->name;
|
iter->base.refname = entry->name;
|
||||||
|
iter->base.referent = entry->u.value.referent;
|
||||||
iter->base.oid = &entry->u.value.oid;
|
iter->base.oid = &entry->u.value.oid;
|
||||||
iter->base.flags = entry->flag;
|
iter->base.flags = entry->flag;
|
||||||
return ITER_OK;
|
return ITER_OK;
|
||||||
|
@ -42,6 +42,7 @@ struct ref_value {
|
|||||||
* referred to by the last reference in the symlink chain.
|
* referred to by the last reference in the symlink chain.
|
||||||
*/
|
*/
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
|
char *referent;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -173,6 +174,7 @@ struct ref_entry *create_dir_entry(struct ref_cache *cache,
|
|||||||
const char *dirname, size_t len);
|
const char *dirname, size_t len);
|
||||||
|
|
||||||
struct ref_entry *create_ref_entry(const char *refname,
|
struct ref_entry *create_ref_entry(const char *refname,
|
||||||
|
const char *referent,
|
||||||
const struct object_id *oid, int flag);
|
const struct object_id *oid, int flag);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -299,6 +299,7 @@ enum do_for_each_ref_flags {
|
|||||||
struct ref_iterator {
|
struct ref_iterator {
|
||||||
struct ref_iterator_vtable *vtable;
|
struct ref_iterator_vtable *vtable;
|
||||||
const char *refname;
|
const char *refname;
|
||||||
|
const char *referent;
|
||||||
const struct object_id *oid;
|
const struct object_id *oid;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
};
|
};
|
||||||
|
@ -454,6 +454,7 @@ static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
|
|||||||
struct reftable_ref_iterator *iter =
|
struct reftable_ref_iterator *iter =
|
||||||
(struct reftable_ref_iterator *)ref_iterator;
|
(struct reftable_ref_iterator *)ref_iterator;
|
||||||
struct reftable_ref_store *refs = iter->refs;
|
struct reftable_ref_store *refs = iter->refs;
|
||||||
|
const char *referent = NULL;
|
||||||
|
|
||||||
while (!iter->err) {
|
while (!iter->err) {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
@ -493,8 +494,11 @@ static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
|
|||||||
refs->base.repo->hash_algo);
|
refs->base.repo->hash_algo);
|
||||||
break;
|
break;
|
||||||
case REFTABLE_REF_SYMREF:
|
case REFTABLE_REF_SYMREF:
|
||||||
if (!refs_resolve_ref_unsafe(&iter->refs->base, iter->ref.refname,
|
referent = refs_resolve_ref_unsafe(&iter->refs->base,
|
||||||
RESOLVE_REF_READING, &iter->oid, &flags))
|
iter->ref.refname,
|
||||||
|
RESOLVE_REF_READING,
|
||||||
|
&iter->oid, &flags);
|
||||||
|
if (!referent)
|
||||||
oidclr(&iter->oid, refs->base.repo->hash_algo);
|
oidclr(&iter->oid, refs->base.repo->hash_algo);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -522,6 +526,7 @@ static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
iter->base.refname = iter->ref.refname;
|
iter->base.refname = iter->ref.refname;
|
||||||
|
iter->base.referent = referent;
|
||||||
iter->base.oid = &iter->oid;
|
iter->base.oid = &iter->oid;
|
||||||
iter->base.flags = flags;
|
iter->base.flags = flags;
|
||||||
|
|
||||||
|
4
remote.c
4
remote.c
@ -2354,7 +2354,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int one_local_ref(const char *refname, const struct object_id *oid,
|
static int one_local_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
@ -2439,7 +2439,7 @@ struct stale_heads_info {
|
|||||||
struct refspec *rs;
|
struct refspec *rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int get_stale_heads_cb(const char *refname, const struct object_id *oid,
|
static int get_stale_heads_cb(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flags, void *cb_data)
|
int flags, void *cb_data)
|
||||||
{
|
{
|
||||||
struct stale_heads_info *info = cb_data;
|
struct stale_heads_info *info = cb_data;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
|
|
||||||
static int register_replace_ref(const char *refname,
|
static int register_replace_ref(const char *refname,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
|
@ -1648,7 +1648,7 @@ struct all_refs_cb {
|
|||||||
struct worktree *wt;
|
struct worktree *wt;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int handle_one_ref(const char *path, const struct object_id *oid,
|
static int handle_one_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -147,7 +147,7 @@ static int update_info_file(char *path,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_info_ref(const char *path, const struct object_id *oid,
|
static int add_info_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
{
|
{
|
||||||
|
@ -612,6 +612,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mark_uninteresting(const char *refname UNUSED,
|
static int mark_uninteresting(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *cb_data UNUSED)
|
void *cb_data UNUSED)
|
||||||
@ -727,6 +728,7 @@ struct commit_array {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int add_ref(const char *refname UNUSED,
|
static int add_ref(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED,
|
int flags UNUSED,
|
||||||
void *cb_data)
|
void *cb_data)
|
||||||
|
@ -953,6 +953,7 @@ static void free_submodules_data(struct string_list *submodules)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int has_remote(const char *refname UNUSED,
|
static int has_remote(const char *refname UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flags UNUSED, void *cb_data UNUSED)
|
int flags UNUSED, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
@ -1273,6 +1274,7 @@ int push_unpushed_submodules(struct repository *r,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int append_oid_to_array(const char *ref UNUSED,
|
static int append_oid_to_array(const char *ref UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flags UNUSED, void *data)
|
int flags UNUSED, void *data)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ static int cmd_rename_ref(struct ref_store *refs, const char **argv)
|
|||||||
return refs_rename_ref(refs, oldref, newref, logmsg);
|
return refs_rename_ref(refs, oldref, newref, logmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int each_ref(const char *refname, const struct object_id *oid,
|
static int each_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flags, void *cb_data UNUSED)
|
int flags, void *cb_data UNUSED)
|
||||||
{
|
{
|
||||||
printf("%s %s 0x%x\n", oid_to_hex(oid), refname, flags);
|
printf("%s %s 0x%x\n", oid_to_hex(oid), refname, flags);
|
||||||
|
@ -857,7 +857,7 @@ static void send_unshallow(struct upload_pack_data *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_ref(const char *refname_full, const struct object_id *oid,
|
static int check_ref(const char *refname_full, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag, void *cb_data);
|
int flag, void *cb_data);
|
||||||
static void deepen(struct upload_pack_data *data, int depth)
|
static void deepen(struct upload_pack_data *data, int depth)
|
||||||
{
|
{
|
||||||
@ -1208,7 +1208,7 @@ static int mark_our_ref(const char *refname, const char *refname_full,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_ref(const char *refname_full, const struct object_id *oid,
|
static int check_ref(const char *refname_full, const char *referent UNUSED,const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data)
|
int flag UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
const char *refname = strip_namespace(refname_full);
|
const char *refname = strip_namespace(refname_full);
|
||||||
@ -1276,14 +1276,14 @@ static void write_v0_ref(struct upload_pack_data *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int send_ref(const char *refname, const struct object_id *oid,
|
static int send_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
|
||||||
int flag UNUSED, void *cb_data)
|
int flag UNUSED, void *cb_data)
|
||||||
{
|
{
|
||||||
write_v0_ref(cb_data, refname, strip_namespace(refname), oid);
|
write_v0_ref(cb_data, refname, strip_namespace(refname), oid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_symref(const char *refname,
|
static int find_symref(const char *refname, const char *referent UNUSED,
|
||||||
const struct object_id *oid UNUSED,
|
const struct object_id *oid UNUSED,
|
||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
|
1
walker.c
1
walker.c
@ -221,6 +221,7 @@ static int interpret_target(struct walker *walker, char *target, struct object_i
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mark_complete(const char *path UNUSED,
|
static int mark_complete(const char *path UNUSED,
|
||||||
|
const char *referent UNUSED,
|
||||||
const struct object_id *oid,
|
const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data UNUSED)
|
void *cb_data UNUSED)
|
||||||
|
@ -546,7 +546,7 @@ int other_head_refs(each_ref_fn fn, void *cb_data)
|
|||||||
refname.buf,
|
refname.buf,
|
||||||
RESOLVE_REF_READING,
|
RESOLVE_REF_READING,
|
||||||
&oid, &flag))
|
&oid, &flag))
|
||||||
ret = fn(refname.buf, &oid, flag, cb_data);
|
ret = fn(refname.buf, NULL, &oid, flag, cb_data);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user