refs: add referent to each_ref_fn

Add a parameter to each_ref_fn so that callers to the ref APIs that use this function as a callback can have acess to the unresolved value of a symbolic ref. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Cai committed Aug 9, 2024 at 15:37 UTC e8207717f1623325fe1c95338fb03c1104ed5687
48 files changed +78 -54
bisect.c
+2 -1
@@ -448,7 +448,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
448 clear_commit_weight(&commit_weight);
449 }
450
451 -static int register_ref(const char *refname, const struct object_id *oid,
451 +static int register_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
452 int flags UNUSED, void *cb_data UNUSED)
453 {
454 struct strbuf good_prefix = STRBUF_INIT;
@@ -1170,6 +1170,7 @@ int estimate_bisect_steps(int all)
1170 }
1171
1172 static int mark_for_removal(const char *refname,
1173 + const char *referent UNUSED,
1174 const struct object_id *oid UNUSED,
1175 int flag UNUSED, void *cb_data)
1176 {
builtin/bisect.c
+3 -1
@@ -356,6 +356,7 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
356 }
357
358 static int inc_nr(const char *refname UNUSED,
359 + const char *referent UNUSED,
360 const struct object_id *oid UNUSED,
361 int flag UNUSED, void *cb_data)
362 {
@@ -545,7 +546,7 @@ finish:
546 return res;
547 }
548
548 -static int add_bisect_ref(const char *refname, const struct object_id *oid,
549 +static int add_bisect_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
550 int flags UNUSED, void *cb)
551 {
552 struct add_bisect_ref_data *data = cb;
@@ -1162,6 +1163,7 @@ static int bisect_visualize(struct bisect_terms *terms, int argc,
1163 }
1164
1165 static int get_first_good(const char *refname UNUSED,
1166 + const char *referent UNUSED,
1167 const struct object_id *oid,
1168 int flag UNUSED, void *cb_data)
1169 {
builtin/checkout.c
+1 -1
@@ -1045,7 +1045,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
1045 report_tracking(new_branch_info);
1046 }
1047
1048 -static int add_pending_uninteresting_ref(const char *refname,
1048 +static int add_pending_uninteresting_ref(const char *refname, const char *referent UNUSED,
1049 const struct object_id *oid,
1050 int flags UNUSED, void *cb_data)
1051 {
builtin/describe.c
+1 -1
@@ -149,7 +149,7 @@ static void add_to_known_names(const char *path,
149 }
150 }
151
152 -static int get_name(const char *path, const struct object_id *oid,
152 +static int get_name(const char *path, const char *referent UNUSED, const struct object_id *oid,
153 int flag UNUSED, void *cb_data UNUSED)
154 {
155 int is_tag = 0;
builtin/fetch.c
+2 -1
@@ -286,7 +286,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
286 return ent;
287 }
288
289 -static int add_one_refname(const char *refname,
289 +static int add_one_refname(const char *refname, const char *referent UNUSED,
290 const struct object_id *oid,
291 int flag UNUSED, void *cbdata)
292 {
@@ -1464,6 +1464,7 @@ static void set_option(struct transport *transport, const char *name, const char
1464
1465
1466 static int add_oid(const char *refname UNUSED,
1467 + const char *referent UNUSED,
1468 const struct object_id *oid,
1469 int flags UNUSED, void *cb_data)
1470 {
builtin/fsck.c
+2 -2
@@ -521,7 +521,7 @@ static int fsck_handle_reflog(const char *logname, void *cb_data)
521 return 0;
522 }
523
524 -static int fsck_handle_ref(const char *refname, const struct object_id *oid,
524 +static int fsck_handle_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
525 int flag UNUSED, void *cb_data UNUSED)
526 {
527 struct object *obj;
@@ -576,7 +576,7 @@ static void get_default_heads(void)
576 strbuf_worktree_ref(wt, &ref, "HEAD");
577 fsck_head_link(ref.buf, &head_points_at, &head_oid);
578 if (head_points_at && !is_null_oid(&head_oid))
579 - fsck_handle_ref(ref.buf, &head_oid, 0, NULL);
579 + fsck_handle_ref(ref.buf, NULL, &head_oid, 0, NULL);
580 strbuf_release(&ref);
581
582 if (include_reflogs)
builtin/gc.c
+1
@@ -836,6 +836,7 @@ struct cg_auto_data {
836 };
837
838 static int dfs_on_ref(const char *refname UNUSED,
839 + const char *referent UNUSED,
840 const struct object_id *oid,
841 int flags UNUSED,
842 void *cb_data)
builtin/name-rev.c
+1 -1
@@ -337,7 +337,7 @@ static int cmp_by_tag_and_age(const void *a_, const void *b_)
337 return a->taggerdate != b->taggerdate;
338 }
339
340 -static int name_ref(const char *path, const struct object_id *oid,
340 +static int name_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
341 int flags UNUSED, void *cb_data)
342 {
343 struct object *o = parse_object(the_repository, oid);
builtin/pack-objects.c
+3 -2
@@ -771,7 +771,7 @@ static enum write_one_status write_one(struct hashfile *f,
771 return WRITE_ONE_WRITTEN;
772 }
773
774 -static int mark_tagged(const char *path UNUSED, const struct object_id *oid,
774 +static int mark_tagged(const char *path UNUSED, const char *referent UNUSED, const struct object_id *oid,
775 int flag UNUSED, void *cb_data UNUSED)
776 {
777 struct object_id peeled;
@@ -3129,7 +3129,7 @@ static void add_tag_chain(const struct object_id *oid)
3129 }
3130 }
3131
3132 -static int add_ref_tag(const char *tag UNUSED, const struct object_id *oid,
3132 +static int add_ref_tag(const char *tag UNUSED, const char *referent UNUSED, const struct object_id *oid,
3133 int flag UNUSED, void *cb_data UNUSED)
3134 {
3135 struct object_id peeled;
@@ -4076,6 +4076,7 @@ static void record_recent_commit(struct commit *commit, void *data UNUSED)
4076 }
4077
4078 static int mark_bitmap_preferred_tip(const char *refname,
4079 + const char *referent UNUSED,
4080 const struct object_id *oid,
4081 int flags UNUSED,
4082 void *data UNUSED)
builtin/receive-pack.c
+1 -1
@@ -300,7 +300,7 @@ static void show_ref(const char *path, const struct object_id *oid)
300 }
301 }
302
303 -static int show_ref_cb(const char *path_full, const struct object_id *oid,
303 +static int show_ref_cb(const char *path_full, const char *referent UNUSED, const struct object_id *oid,
304 int flag UNUSED, void *data)
305 {
306 struct oidset *seen = data;
builtin/remote.c
+3 -1
@@ -543,6 +543,7 @@ struct branches_for_remote {
543 };
544
545 static int add_branch_for_removal(const char *refname,
546 + const char *referent UNUSED,
547 const struct object_id *oid UNUSED,
548 int flags UNUSED, void *cb_data)
549 {
@@ -585,7 +586,7 @@ struct rename_info {
586 uint32_t symrefs_nr;
587 };
588
588 -static int read_remote_branches(const char *refname,
589 +static int read_remote_branches(const char *refname, const char *referent UNUSED,
590 const struct object_id *oid UNUSED,
591 int flags UNUSED, void *cb_data)
592 {
@@ -971,6 +972,7 @@ static void free_remote_ref_states(struct ref_states *states)
972 }
973
974 static int append_ref_to_tracked_list(const char *refname,
975 + const char *referent UNUSED,
976 const struct object_id *oid UNUSED,
977 int flags, void *cb_data)
978 {
builtin/repack.c
+1
@@ -667,6 +667,7 @@ struct midx_snapshot_ref_data {
667 };
668
669 static int midx_snapshot_ref_one(const char *refname UNUSED,
670 + const char *referent UNUSED,
671 const struct object_id *oid,
672 int flag UNUSED, void *_data)
673 {
builtin/replace.c
+1
@@ -49,6 +49,7 @@ struct show_data {
49 };
50
51 static int show_reference(const char *refname,
52 + const char *referent UNUSED,
53 const struct object_id *oid,
54 int flag UNUSED, void *cb_data)
55 {
builtin/rev-parse.c
+2 -2
@@ -211,7 +211,7 @@ static int show_default(void)
211 return 0;
212 }
213
214 -static int show_reference(const char *refname, const struct object_id *oid,
214 +static int show_reference(const char *refname, const char *referent UNUSED, const struct object_id *oid,
215 int flag UNUSED, void *cb_data UNUSED)
216 {
217 if (ref_excluded(&ref_excludes, refname))
@@ -220,7 +220,7 @@ static int show_reference(const char *refname, const struct object_id *oid,
220 return 0;
221 }
222
223 -static int anti_reference(const char *refname, const struct object_id *oid,
223 +static int anti_reference(const char *refname, const char *referent UNUSED, const struct object_id *oid,
224 int flag UNUSED, void *cb_data UNUSED)
225 {
226 show_rev(REVERSED, oid, refname);
builtin/show-branch.c
+4 -4
@@ -410,7 +410,7 @@ static int append_ref(const char *refname, const struct object_id *oid,
410 return 0;
411 }
412
413 -static int append_head_ref(const char *refname, const struct object_id *oid,
413 +static int append_head_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
414 int flag UNUSED, void *cb_data UNUSED)
415 {
416 struct object_id tmp;
@@ -425,7 +425,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,
425 return append_ref(refname + ofs, oid, 0);
426 }
427
428 -static int append_remote_ref(const char *refname, const struct object_id *oid,
428 +static int append_remote_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
429 int flag UNUSED, void *cb_data UNUSED)
430 {
431 struct object_id tmp;
@@ -451,7 +451,7 @@ static int append_tag_ref(const char *refname, const struct object_id *oid,
451 static const char *match_ref_pattern = NULL;
452 static int match_ref_slash = 0;
453
454 -static int append_matching_ref(const char *refname, const struct object_id *oid,
454 +static int append_matching_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
455 int flag, void *cb_data)
456 {
457 /* 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,
468 if (wildmatch(match_ref_pattern, tail, 0))
469 return 0;
470 if (starts_with(refname, "refs/heads/"))
471 - return append_head_ref(refname, oid, flag, cb_data);
471 + return append_head_ref(refname, NULL, oid, flag, cb_data);
472 if (starts_with(refname, "refs/tags/"))
473 return append_tag_ref(refname, oid, flag, cb_data);
474 return append_ref(refname, oid, 0);
builtin/show-ref.c
+2 -1
@@ -63,7 +63,7 @@ struct show_ref_data {
63 int show_head;
64 };
65
66 -static int show_ref(const char *refname, const struct object_id *oid,
66 +static int show_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
67 int flag UNUSED, void *cbdata)
68 {
69 struct show_ref_data *data = cbdata;
@@ -97,6 +97,7 @@ match:
97 }
98
99 static int add_existing(const char *refname,
100 + const char *referent UNUSED,
101 const struct object_id *oid UNUSED,
102 int flag UNUSED, void *cbdata)
103 {
builtin/submodule--helper.c
+1
@@ -608,6 +608,7 @@ static void print_status(unsigned int flags, char state, const char *path,
608 }
609
610 static int handle_submodule_head_ref(const char *refname UNUSED,
611 + const char *referent UNUSED,
612 const struct object_id *oid,
613 int flags UNUSED,
614 void *cb_data)
builtin/worktree.c
+1
@@ -626,6 +626,7 @@ static void print_preparing_worktree_line(int detach,
626 * Returns 0 on failure and non-zero on success.
627 */
628 static int first_valid_ref(const char *refname UNUSED,
629 + const char *referent UNUSED,
630 const struct object_id *oid UNUSED,
631 int flags UNUSED,
632 void *cb_data UNUSED)
commit-graph.c
+1
@@ -1847,6 +1847,7 @@ struct refs_cb_data {
1847 };
1848
1849 static int add_ref_to_set(const char *refname UNUSED,
1850 + const char *referent UNUSED,
1851 const struct object_id *oid,
1852 int flags UNUSED, void *cb_data)
1853 {
delta-islands.c
+1 -1
@@ -390,7 +390,7 @@ static void add_ref_to_island(kh_str_t *remote_islands, const char *island_name,
390 rl->hash += sha_core;
391 }
392
393 -static int find_island_for_ref(const char *refname, const struct object_id *oid,
393 +static int find_island_for_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
394 int flags UNUSED, void *cb)
395 {
396 struct island_load_data *ild = cb;
fetch-pack.c
+2
@@ -183,6 +183,7 @@ static int rev_list_insert_ref(struct fetch_negotiator *negotiator,
183 }
184
185 static int rev_list_insert_ref_oid(const char *refname UNUSED,
186 + const char *referent UNUSED,
187 const struct object_id *oid,
188 int flag UNUSED,
189 void *cb_data)
@@ -610,6 +611,7 @@ static int mark_complete(const struct object_id *oid)
611 }
612
613 static int mark_complete_oid(const char *refname UNUSED,
614 + const char *referent UNUSED,
615 const struct object_id *oid,
616 int flag UNUSED,
617 void *cb_data UNUSED)
help.c
+1 -1
@@ -804,7 +804,7 @@ struct similar_ref_cb {
804 struct string_list *similar_refs;
805 };
806
807 -static int append_similar_ref(const char *refname,
807 +static int append_similar_ref(const char *refname, const char *referent UNUSED,
808 const struct object_id *oid UNUSED,
809 int flags UNUSED, void *cb_data)
810 {
http-backend.c
+2 -2
@@ -512,7 +512,7 @@ static void run_service(const char **argv, int buffer_input)
512 exit(1);
513 }
514
515 -static int show_text_ref(const char *name, const struct object_id *oid,
515 +static int show_text_ref(const char *name, const char *referent UNUSED, const struct object_id *oid,
516 int flag UNUSED, void *cb_data)
517 {
518 const char *name_nons = strip_namespace(name);
@@ -568,7 +568,7 @@ static void get_info_refs(struct strbuf *hdr, char *arg UNUSED)
568 strbuf_release(&buf);
569 }
570
571 -static int show_head_ref(const char *refname, const struct object_id *oid,
571 +static int show_head_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
572 int flag, void *cb_data)
573 {
574 struct strbuf *buf = cb_data;
log-tree.c
+1 -1
@@ -145,7 +145,7 @@ static int ref_filter_match(const char *refname,
145 return 1;
146 }
147
148 -static int add_ref_decoration(const char *refname, const struct object_id *oid,
148 +static int add_ref_decoration(const char *refname, const char *referent UNUSED, const struct object_id *oid,
149 int flags UNUSED,
150 void *cb_data)
151 {
ls-refs.c
+2 -2
@@ -77,7 +77,7 @@ struct ls_refs_data {
77 unsigned unborn : 1;
78 };
79
80 -static int send_ref(const char *refname, const struct object_id *oid,
80 +static int send_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
81 int flag, void *cb_data)
82 {
83 struct ls_refs_data *data = cb_data;
@@ -135,7 +135,7 @@ static void send_possibly_unborn_head(struct ls_refs_data *data)
135 oid_is_null = is_null_oid(&oid);
136 if (!oid_is_null ||
137 (data->unborn && data->symrefs && (flag & REF_ISSYMREF)))
138 - send_ref(namespaced.buf, oid_is_null ? NULL : &oid, flag, data);
138 + send_ref(namespaced.buf, NULL, oid_is_null ? NULL : &oid, flag, data);
139 strbuf_release(&namespaced);
140 }
141
midx-write.c
+1 -1
@@ -655,7 +655,7 @@ static void prepare_midx_packing_data(struct packing_data *pdata,
655 trace2_region_leave("midx", "prepare_midx_packing_data", the_repository);
656 }
657
658 -static int add_ref_to_pending(const char *refname,
658 +static int add_ref_to_pending(const char *refname, const char *referent UNUSED,
659 const struct object_id *oid,
660 int flag, void *cb_data)
661 {
negotiator/default.c
+1 -1
@@ -38,7 +38,7 @@ static void rev_list_push(struct negotiation_state *ns,
38 }
39 }
40
41 -static int clear_marks(const char *refname, const struct object_id *oid,
41 +static int clear_marks(const char *refname, const char *referent UNUSED, const struct object_id *oid,
42 int flag UNUSED,
43 void *cb_data UNUSED)
44 {
negotiator/skipping.c
+1 -1
@@ -75,7 +75,7 @@ static struct entry *rev_list_push(struct data *data, struct commit *commit, int
75 return entry;
76 }
77
78 -static int clear_marks(const char *refname, const struct object_id *oid,
78 +static int clear_marks(const char *refname, const char *referent UNUSED, const struct object_id *oid,
79 int flag UNUSED,
80 void *cb_data UNUSED)
81 {
notes.c
+1 -1
@@ -932,7 +932,7 @@ out:
932 return ret;
933 }
934
935 -static int string_list_add_one_ref(const char *refname,
935 +static int string_list_add_one_ref(const char *refname, const char *referent UNUSED,
936 const struct object_id *oid UNUSED,
937 int flag UNUSED, void *cb)
938 {
object-name.c
+1 -1
@@ -1365,7 +1365,7 @@ struct handle_one_ref_cb {
1365 struct commit_list **list;
1366 };
1367
1368 -static int handle_one_ref(const char *path, const struct object_id *oid,
1368 +static int handle_one_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
1369 int flag UNUSED,
1370 void *cb_data)
1371 {
pseudo-merge.c
+1
@@ -201,6 +201,7 @@ void load_pseudo_merges_from_config(struct string_list *list)
201 }
202
203 static int find_pseudo_merge_group_for_ref(const char *refname,
204 + const char *referent UNUSED,
205 const struct object_id *oid,
206 int flags UNUSED,
207 void *_data)
reachable.c
+1 -1
@@ -79,7 +79,7 @@ static void add_rebase_files(struct rev_info *revs)
79 free_worktrees(worktrees);
80 }
81
82 -static int add_one_ref(const char *path, const struct object_id *oid,
82 +static int add_one_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
83 int flag, void *cb_data)
84 {
85 struct rev_info *revs = (struct rev_info *)cb_data;
ref-filter.c
+2 -2
@@ -2865,7 +2865,7 @@ struct ref_filter_cbdata {
2865 * A call-back given to for_each_ref(). Filter refs and keep them for
2866 * later object processing.
2867 */
2868 -static int filter_one(const char *refname, const struct object_id *oid, int flag, void *cb_data)
2868 +static int filter_one(const char *refname, const char *referent UNUSED, const struct object_id *oid, int flag, void *cb_data)
2869 {
2870 struct ref_filter_cbdata *ref_cbdata = cb_data;
2871 struct ref_array_item *ref;
@@ -2900,7 +2900,7 @@ struct ref_filter_and_format_cbdata {
2900 } internal;
2901 };
2902
2903 -static int filter_and_format_one(const char *refname, const struct object_id *oid, int flag, void *cb_data)
2903 +static int filter_and_format_one(const char *refname, const char *referent UNUSED, const struct object_id *oid, int flag, void *cb_data)
2904 {
2905 struct ref_filter_and_format_cbdata *ref_cbdata = cb_data;
2906 struct ref_array_item *ref;
reflog.c
+1
@@ -300,6 +300,7 @@ int should_expire_reflog_ent_verbose(struct object_id *ooid,
300 }
301
302 static int push_tip_to_list(const char *refname UNUSED,
303 + const char *referent UNUSED,
304 const struct object_id *oid,
305 int flags, void *cb_data)
306 {
refs.c
+7 -7
@@ -414,7 +414,7 @@ int refs_ref_exists(struct ref_store *refs, const char *refname)
414 NULL, NULL);
415 }
416
417 -static int for_each_filter_refs(const char *refname,
417 +static int for_each_filter_refs(const char *refname, const char *referent,
418 const struct object_id *oid,
419 int flags, void *data)
420 {
@@ -424,7 +424,7 @@ static int for_each_filter_refs(const char *refname,
424 return 0;
425 if (filter->prefix)
426 skip_prefix(refname, filter->prefix, &refname);
427 - return filter->fn(refname, oid, flags, filter->cb_data);
427 + return filter->fn(refname, referent, oid, flags, filter->cb_data);
428 }
429
430 struct warn_if_dangling_data {
@@ -435,7 +435,7 @@ struct warn_if_dangling_data {
435 const char *msg_fmt;
436 };
437
438 -static int warn_if_dangling_symref(const char *refname,
438 +static int warn_if_dangling_symref(const char *refname, const char *referent UNUSED,
439 const struct object_id *oid UNUSED,
440 int flags, void *cb_data)
441 {
@@ -506,7 +506,7 @@ int refs_head_ref_namespaced(struct ref_store *refs, each_ref_fn fn, void *cb_da
506
507 strbuf_addf(&buf, "%sHEAD", get_git_namespace());
508 if (!refs_read_ref_full(refs, buf.buf, RESOLVE_REF_READING, &oid, &flag))
509 - ret = fn(buf.buf, &oid, flag, cb_data);
509 + ret = fn(buf.buf, NULL, &oid, flag, cb_data);
510 strbuf_release(&buf);
511
512 return ret;
@@ -1547,7 +1547,7 @@ int refs_head_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
1547
1548 if (refs_resolve_ref_unsafe(refs, "HEAD", RESOLVE_REF_READING,
1549 &oid, &flag))
1550 - return fn("HEAD", &oid, flag, cb_data);
1550 + return fn("HEAD", NULL, &oid, flag, cb_data);
1551
1552 return 0;
1553 }
@@ -2387,7 +2387,7 @@ struct do_for_each_reflog_help {
2387 void *cb_data;
2388 };
2389
2390 -static int do_for_each_reflog_helper(const char *refname,
2390 +static int do_for_each_reflog_helper(const char *refname, const char *referent,
2391 const struct object_id *oid UNUSED,
2392 int flags,
2393 void *cb_data)
@@ -2593,7 +2593,7 @@ struct migration_data {
2593 struct strbuf *errbuf;
2594 };
2595
2596 -static int migrate_one_ref(const char *refname, const struct object_id *oid,
2596 +static int migrate_one_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
2597 int flags, void *cb_data)
2598 {
2599 struct migration_data *data = cb_data;
refs.h
+1 -1
@@ -298,7 +298,7 @@ struct ref_transaction;
298 * arguments is only guaranteed to be valid for the duration of a
299 * single callback invocation.
300 */
301 -typedef int each_ref_fn(const char *refname,
301 +typedef int each_ref_fn(const char *refname, const char *referent,
302 const struct object_id *oid, int flags, void *cb_data);
303
304 /*
refs/files-backend.c
+1 -1
@@ -3044,7 +3044,7 @@ static int files_transaction_abort(struct ref_store *ref_store,
3044 return 0;
3045 }
3046
3047 -static int ref_present(const char *refname,
3047 +static int ref_present(const char *refname, const char *referent UNUSED,
3048 const struct object_id *oid UNUSED,
3049 int flags UNUSED,
3050 void *cb_data)
refs/iterator.c
+1 -1
@@ -450,7 +450,7 @@ int do_for_each_ref_iterator(struct ref_iterator *iter,
450
451 current_ref_iter = iter;
452 while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
453 - retval = fn(iter->refname, iter->oid, iter->flags, cb_data);
453 + retval = fn(iter->refname, iter->referent, iter->oid, iter->flags, cb_data);
454 if (retval) {
455 /*
456 * If ref_iterator_abort() returns ITER_ERROR,
remote.c
+2 -2
@@ -2354,7 +2354,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
2354 return 1;
2355 }
2356
2357 -static int one_local_ref(const char *refname, const struct object_id *oid,
2357 +static int one_local_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
2358 int flag UNUSED,
2359 void *cb_data)
2360 {
@@ -2439,7 +2439,7 @@ struct stale_heads_info {
2439 struct refspec *rs;
2440 };
2441
2442 -static int get_stale_heads_cb(const char *refname, const struct object_id *oid,
2442 +static int get_stale_heads_cb(const char *refname, const char *referent UNUSED, const struct object_id *oid,
2443 int flags, void *cb_data)
2444 {
2445 struct stale_heads_info *info = cb_data;
replace-object.c
+1
@@ -9,6 +9,7 @@
9 #include "commit.h"
10
11 static int register_replace_ref(const char *refname,
12 + const char *referent UNUSED,
13 const struct object_id *oid,
14 int flag UNUSED,
15 void *cb_data)
revision.c
+1 -1
@@ -1648,7 +1648,7 @@ struct all_refs_cb {
1648 struct worktree *wt;
1649 };
1650
1651 -static int handle_one_ref(const char *path, const struct object_id *oid,
1651 +static int handle_one_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
1652 int flag UNUSED,
1653 void *cb_data)
1654 {
server-info.c
+1 -1
@@ -147,7 +147,7 @@ out:
147 return ret;
148 }
149
150 -static int add_info_ref(const char *path, const struct object_id *oid,
150 +static int add_info_ref(const char *path, const char *referent UNUSED, const struct object_id *oid,
151 int flag UNUSED,
152 void *cb_data)
153 {
shallow.c
+2
@@ -612,6 +612,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
612 }
613
614 static int mark_uninteresting(const char *refname UNUSED,
615 + const char *referent UNUSED,
616 const struct object_id *oid,
617 int flags UNUSED,
618 void *cb_data UNUSED)
@@ -727,6 +728,7 @@ struct commit_array {
728 };
729
730 static int add_ref(const char *refname UNUSED,
731 + const char *referent UNUSED,
732 const struct object_id *oid,
733 int flags UNUSED,
734 void *cb_data)
submodule.c
+2
@@ -953,6 +953,7 @@ static void free_submodules_data(struct string_list *submodules)
953 }
954
955 static int has_remote(const char *refname UNUSED,
956 + const char *referent UNUSED,
957 const struct object_id *oid UNUSED,
958 int flags UNUSED, void *cb_data UNUSED)
959 {
@@ -1273,6 +1274,7 @@ int push_unpushed_submodules(struct repository *r,
1274 }
1275
1276 static int append_oid_to_array(const char *ref UNUSED,
1277 + const char *referent UNUSED,
1278 const struct object_id *oid,
1279 int flags UNUSED, void *data)
1280 {
t/helper/test-ref-store.c
+1 -1
@@ -156,7 +156,7 @@ static int cmd_rename_ref(struct ref_store *refs, const char **argv)
156 return refs_rename_ref(refs, oldref, newref, logmsg);
157 }
158
159 -static int each_ref(const char *refname, const struct object_id *oid,
159 +static int each_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
160 int flags, void *cb_data UNUSED)
161 {
162 printf("%s %s 0x%x\n", oid_to_hex(oid), refname, flags);
upload-pack.c
+4 -4
@@ -857,7 +857,7 @@ static void send_unshallow(struct upload_pack_data *data)
857 }
858 }
859
860 -static int check_ref(const char *refname_full, const struct object_id *oid,
860 +static int check_ref(const char *refname_full, const char *referent UNUSED, const struct object_id *oid,
861 int flag, void *cb_data);
862 static void deepen(struct upload_pack_data *data, int depth)
863 {
@@ -1208,7 +1208,7 @@ static int mark_our_ref(const char *refname, const char *refname_full,
1208 return 0;
1209 }
1210
1211 -static int check_ref(const char *refname_full, const struct object_id *oid,
1211 +static int check_ref(const char *refname_full, const char *referent UNUSED,const struct object_id *oid,
1212 int flag UNUSED, void *cb_data)
1213 {
1214 const char *refname = strip_namespace(refname_full);
@@ -1276,14 +1276,14 @@ static void write_v0_ref(struct upload_pack_data *data,
1276 return;
1277 }
1278
1279 -static int send_ref(const char *refname, const struct object_id *oid,
1279 +static int send_ref(const char *refname, const char *referent UNUSED, const struct object_id *oid,
1280 int flag UNUSED, void *cb_data)
1281 {
1282 write_v0_ref(cb_data, refname, strip_namespace(refname), oid);
1283 return 0;
1284 }
1285
1286 -static int find_symref(const char *refname,
1286 +static int find_symref(const char *refname, const char *referent UNUSED,
1287 const struct object_id *oid UNUSED,
1288 int flag, void *cb_data)
1289 {
walker.c
+1
@@ -221,6 +221,7 @@ static int interpret_target(struct walker *walker, char *target, struct object_i
221 }
222
223 static int mark_complete(const char *path UNUSED,
224 + const char *referent UNUSED,
225 const struct object_id *oid,
226 int flag UNUSED,
227 void *cb_data UNUSED)
worktree.c
+1 -1
@@ -546,7 +546,7 @@ int other_head_refs(each_ref_fn fn, void *cb_data)
546 refname.buf,
547 RESOLVE_REF_READING,
548 &oid, &flag))
549 - ret = fn(refname.buf, &oid, flag, cb_data);
549 + ret = fn(refname.buf, NULL, &oid, flag, cb_data);
550 if (ret)
551 break;
552 }