refs: remove functions without ref store

The preceding commit has rewritten all callers of ref-related functions to use the equivalents that accept a `struct ref_store`. Consequently, the respective variants without the ref store are now unused. Remove them. There are likely patch series in-flight that use the now-removed functions. To help the authors, the old implementations have been added to "refs.c" in an ifdef'd section as a reference for how to migrate each of the respective callers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed May 7, 2024 at 09:11 UTC c8f815c2083c4b340d4148a15d45c55f2fcc7d3f
2 files changed +209 -268
refs.c
-198
@@ -384,14 +384,6 @@ char *refs_resolve_refdup(struct ref_store *refs,
384 return xstrdup_or_null(result);
385 }
386
387 -char *resolve_refdup(const char *refname, int resolve_flags,
388 - struct object_id *oid, int *flags)
389 -{
390 - return refs_resolve_refdup(get_main_ref_store(the_repository),
391 - refname, resolve_flags,
392 - oid, flags);
393 -}
394 -
387 /* The argument to for_each_filter_refs */
388 struct for_each_ref_filter {
389 const char *pattern;
@@ -409,33 +401,17 @@ int refs_read_ref_full(struct ref_store *refs, const char *refname,
401 return -1;
402 }
403
412 -int read_ref_full(const char *refname, int resolve_flags, struct object_id *oid, int *flags)
413 -{
414 - return refs_read_ref_full(get_main_ref_store(the_repository), refname,
415 - resolve_flags, oid, flags);
416 -}
417 -
404 int refs_read_ref(struct ref_store *refs, const char *refname, struct object_id *oid)
405 {
406 return refs_read_ref_full(refs, refname, RESOLVE_REF_READING, oid, NULL);
407 }
408
423 -int read_ref(const char *refname, struct object_id *oid)
424 -{
425 - return refs_read_ref(get_main_ref_store(the_repository), refname, oid);
426 -}
427 -
409 int refs_ref_exists(struct ref_store *refs, const char *refname)
410 {
411 return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING,
412 NULL, NULL);
413 }
414
434 -int ref_exists(const char *refname)
435 -{
436 - return refs_ref_exists(get_main_ref_store(the_repository), refname);
437 -}
438 -
415 static int for_each_filter_refs(const char *refname,
416 const struct object_id *oid,
417 int flags, void *data)
@@ -530,31 +506,16 @@ int refs_for_each_tag_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
506 return refs_for_each_ref_in(refs, "refs/tags/", fn, cb_data);
507 }
508
533 -int for_each_tag_ref(each_ref_fn fn, void *cb_data)
534 -{
535 - return refs_for_each_tag_ref(get_main_ref_store(the_repository), fn, cb_data);
536 -}
537 -
509 int refs_for_each_branch_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
510 {
511 return refs_for_each_ref_in(refs, "refs/heads/", fn, cb_data);
512 }
513
543 -int for_each_branch_ref(each_ref_fn fn, void *cb_data)
544 -{
545 - return refs_for_each_branch_ref(get_main_ref_store(the_repository), fn, cb_data);
546 -}
547 -
514 int refs_for_each_remote_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
515 {
516 return refs_for_each_ref_in(refs, "refs/remotes/", fn, cb_data);
517 }
518
553 -int for_each_remote_ref(each_ref_fn fn, void *cb_data)
554 -{
555 - return refs_for_each_remote_ref(get_main_ref_store(the_repository), fn, cb_data);
556 -}
557 -
519 int refs_head_ref_namespaced(struct ref_store *refs, each_ref_fn fn, void *cb_data)
520 {
521 struct strbuf buf = STRBUF_INIT;
@@ -570,12 +531,6 @@ int refs_head_ref_namespaced(struct ref_store *refs, each_ref_fn fn, void *cb_da
531 return ret;
532 }
533
573 -int head_ref_namespaced(each_ref_fn fn, void *cb_data)
574 -{
575 - return refs_head_ref_namespaced(get_main_ref_store(the_repository),
576 - fn, cb_data);
577 -}
578 -
534 void normalize_glob_ref(struct string_list_item *item, const char *prefix,
535 const char *pattern)
536 {
@@ -632,25 +587,12 @@ int refs_for_each_glob_ref_in(struct ref_store *refs, each_ref_fn fn,
587 return ret;
588 }
589
635 -int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
636 - const char *prefix, void *cb_data)
637 -{
638 - return refs_for_each_glob_ref_in(get_main_ref_store(the_repository),
639 - fn, pattern, prefix, cb_data);
640 -}
641 -
590 int refs_for_each_glob_ref(struct ref_store *refs, each_ref_fn fn,
591 const char *pattern, void *cb_data)
592 {
593 return refs_for_each_glob_ref_in(refs, fn, pattern, NULL, cb_data);
594 }
595
648 -int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
649 -{
650 - return refs_for_each_glob_ref(get_main_ref_store(the_repository),
651 - fn, pattern, cb_data);
652 -}
653 -
596 const char *prettify_refname(const char *name)
597 {
598 if (skip_prefix(name, "refs/heads/", &name) ||
@@ -1024,13 +966,6 @@ int refs_delete_ref(struct ref_store *refs, const char *msg,
966 return 0;
967 }
968
1027 -int delete_ref(const char *msg, const char *refname,
1028 - const struct object_id *old_oid, unsigned int flags)
1029 -{
1030 - return refs_delete_ref(get_main_ref_store(the_repository), msg, refname,
1031 - old_oid, flags);
1032 -}
1033 -
969 static void copy_reflog_msg(struct strbuf *sb, const char *msg)
970 {
971 char c;
@@ -1223,11 +1158,6 @@ struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
1158 return tr;
1159 }
1160
1226 -struct ref_transaction *ref_transaction_begin(struct strbuf *err)
1227 -{
1228 - return ref_store_transaction_begin(get_main_ref_store(the_repository), err);
1229 -}
1230 -
1161 void ref_transaction_free(struct ref_transaction *transaction)
1162 {
1163 size_t i;
@@ -1396,15 +1326,6 @@ int refs_update_ref(struct ref_store *refs, const char *msg,
1326 return 0;
1327 }
1328
1399 -int update_ref(const char *msg, const char *refname,
1400 - const struct object_id *new_oid,
1401 - const struct object_id *old_oid,
1402 - unsigned int flags, enum action_on_err onerr)
1403 -{
1404 - return refs_update_ref(get_main_ref_store(the_repository), msg, refname, new_oid,
1405 - old_oid, flags, onerr);
1406 -}
1407 -
1329 /*
1330 * Check that the string refname matches a rule of the form
1331 * "{prefix}%.*s{suffix}". So "foo/bar/baz" would match the rule
@@ -1506,12 +1427,6 @@ char *refs_shorten_unambiguous_ref(struct ref_store *refs,
1427 return xstrdup(refname);
1428 }
1429
1509 -char *shorten_unambiguous_ref(const char *refname, int strict)
1510 -{
1511 - return refs_shorten_unambiguous_ref(get_main_ref_store(the_repository),
1512 - refname, strict);
1513 -}
1514 -
1430 int parse_hide_refs_config(const char *var, const char *value, const char *section,
1431 struct strvec *hide_refs)
1432 {
@@ -1630,11 +1545,6 @@ int refs_head_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
1545 return 0;
1546 }
1547
1633 -int head_ref(each_ref_fn fn, void *cb_data)
1634 -{
1635 - return refs_head_ref(get_main_ref_store(the_repository), fn, cb_data);
1636 -}
1637 -
1548 struct ref_iterator *refs_ref_iterator_begin(
1549 struct ref_store *refs,
1550 const char *prefix,
@@ -1729,30 +1639,12 @@ int refs_for_each_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
1639 return do_for_each_ref(refs, "", NULL, fn, 0, 0, cb_data);
1640 }
1641
1732 -int for_each_ref(each_ref_fn fn, void *cb_data)
1733 -{
1734 - return refs_for_each_ref(get_main_ref_store(the_repository), fn, cb_data);
1735 -}
1736 -
1642 int refs_for_each_ref_in(struct ref_store *refs, const char *prefix,
1643 each_ref_fn fn, void *cb_data)
1644 {
1645 return do_for_each_ref(refs, prefix, NULL, fn, strlen(prefix), 0, cb_data);
1646 }
1647
1743 -int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data)
1744 -{
1745 - return refs_for_each_ref_in(get_main_ref_store(the_repository), prefix, fn, cb_data);
1746 -}
1747 -
1748 -int for_each_fullref_in(const char *prefix,
1749 - const char **exclude_patterns,
1750 - each_ref_fn fn, void *cb_data)
1751 -{
1752 - return refs_for_each_fullref_in(get_main_ref_store(the_repository),
1753 - prefix, exclude_patterns, fn, cb_data);
1754 -}
1755 -
1648 int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix,
1649 const char **exclude_patterns,
1650 each_ref_fn fn, void *cb_data)
@@ -1780,24 +1672,12 @@ int refs_for_each_namespaced_ref(struct ref_store *refs,
1672 return ret;
1673 }
1674
1783 -int for_each_namespaced_ref(const char **exclude_patterns,
1784 - each_ref_fn fn, void *cb_data)
1785 -{
1786 - return refs_for_each_namespaced_ref(get_main_ref_store(the_repository),
1787 - exclude_patterns, fn, cb_data);
1788 -}
1789 -
1675 int refs_for_each_rawref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
1676 {
1677 return do_for_each_ref(refs, "", NULL, fn, 0,
1678 DO_FOR_EACH_INCLUDE_BROKEN, cb_data);
1679 }
1680
1796 -int for_each_rawref(each_ref_fn fn, void *cb_data)
1797 -{
1798 - return refs_for_each_rawref(get_main_ref_store(the_repository), fn, cb_data);
1799 -}
1800 -
1681 int refs_for_each_include_root_refs(struct ref_store *refs, each_ref_fn fn,
1682 void *cb_data)
1683 {
@@ -2063,13 +1943,6 @@ int refs_init_db(struct ref_store *refs, int flags, struct strbuf *err)
1943 return refs->be->init_db(refs, flags, err);
1944 }
1945
2066 -const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
2067 - struct object_id *oid, int *flags)
2068 -{
2069 - return refs_resolve_ref_unsafe(get_main_ref_store(the_repository), refname,
2070 - resolve_flags, oid, flags);
2071 -}
2072 -
1946 int resolve_gitlink_ref(const char *submodule, const char *refname,
1947 struct object_id *oid)
1948 {
@@ -2323,13 +2196,6 @@ int refs_create_symref(struct ref_store *refs,
2196 return retval;
2197 }
2198
2326 -int create_symref(const char *ref_target, const char *refs_heads_master,
2327 - const char *logmsg)
2328 -{
2329 - return refs_create_symref(get_main_ref_store(the_repository), ref_target,
2330 - refs_heads_master, logmsg);
2331 -}
2332 -
2199 int ref_update_reject_duplicates(struct string_list *refnames,
2200 struct strbuf *err)
2201 {
@@ -2623,11 +2489,6 @@ int refs_for_each_reflog(struct ref_store *refs, each_reflog_fn fn, void *cb_dat
2489 do_for_each_reflog_helper, &hp);
2490 }
2491
2626 -int for_each_reflog(each_reflog_fn fn, void *cb_data)
2627 -{
2628 - return refs_for_each_reflog(get_main_ref_store(the_repository), fn, cb_data);
2629 -}
2630 -
2492 int refs_for_each_reflog_ent_reverse(struct ref_store *refs,
2493 const char *refname,
2494 each_reflog_ent_fn fn,
@@ -2637,58 +2498,28 @@ int refs_for_each_reflog_ent_reverse(struct ref_store *refs,
2498 fn, cb_data);
2499 }
2500
2640 -int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn,
2641 - void *cb_data)
2642 -{
2643 - return refs_for_each_reflog_ent_reverse(get_main_ref_store(the_repository),
2644 - refname, fn, cb_data);
2645 -}
2646 -
2501 int refs_for_each_reflog_ent(struct ref_store *refs, const char *refname,
2502 each_reflog_ent_fn fn, void *cb_data)
2503 {
2504 return refs->be->for_each_reflog_ent(refs, refname, fn, cb_data);
2505 }
2506
2653 -int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn,
2654 - void *cb_data)
2655 -{
2656 - return refs_for_each_reflog_ent(get_main_ref_store(the_repository), refname,
2657 - fn, cb_data);
2658 -}
2659 -
2507 int refs_reflog_exists(struct ref_store *refs, const char *refname)
2508 {
2509 return refs->be->reflog_exists(refs, refname);
2510 }
2511
2665 -int reflog_exists(const char *refname)
2666 -{
2667 - return refs_reflog_exists(get_main_ref_store(the_repository), refname);
2668 -}
2669 -
2512 int refs_create_reflog(struct ref_store *refs, const char *refname,
2513 struct strbuf *err)
2514 {
2515 return refs->be->create_reflog(refs, refname, err);
2516 }
2517
2676 -int safe_create_reflog(const char *refname, struct strbuf *err)
2677 -{
2678 - return refs_create_reflog(get_main_ref_store(the_repository), refname,
2679 - err);
2680 -}
2681 -
2518 int refs_delete_reflog(struct ref_store *refs, const char *refname)
2519 {
2520 return refs->be->delete_reflog(refs, refname);
2521 }
2522
2687 -int delete_reflog(const char *refname)
2688 -{
2689 - return refs_delete_reflog(get_main_ref_store(the_repository), refname);
2690 -}
2691 -
2523 int refs_reflog_expire(struct ref_store *refs,
2524 const char *refname,
2525 unsigned int flags,
@@ -2702,19 +2533,6 @@ int refs_reflog_expire(struct ref_store *refs,
2533 cleanup_fn, policy_cb_data);
2534 }
2535
2705 -int reflog_expire(const char *refname,
2706 - unsigned int flags,
2707 - reflog_expiry_prepare_fn prepare_fn,
2708 - reflog_expiry_should_prune_fn should_prune_fn,
2709 - reflog_expiry_cleanup_fn cleanup_fn,
2710 - void *policy_cb_data)
2711 -{
2712 - return refs_reflog_expire(get_main_ref_store(the_repository),
2713 - refname, flags,
2714 - prepare_fn, should_prune_fn,
2715 - cleanup_fn, policy_cb_data);
2716 -}
2717 -
2536 int initial_ref_transaction_commit(struct ref_transaction *transaction,
2537 struct strbuf *err)
2538 {
@@ -2793,12 +2611,6 @@ out:
2611 return ret;
2612 }
2613
2796 -int delete_refs(const char *msg, struct string_list *refnames,
2797 - unsigned int flags)
2798 -{
2799 - return refs_delete_refs(get_main_ref_store(the_repository), msg, refnames, flags);
2800 -}
2801 -
2614 int refs_rename_ref(struct ref_store *refs, const char *oldref,
2615 const char *newref, const char *logmsg)
2616 {
@@ -2811,11 +2623,6 @@ int refs_rename_ref(struct ref_store *refs, const char *oldref,
2623 return retval;
2624 }
2625
2814 -int rename_ref(const char *oldref, const char *newref, const char *logmsg)
2815 -{
2816 - return refs_rename_ref(get_main_ref_store(the_repository), oldref, newref, logmsg);
2817 -}
2818 -
2626 int refs_copy_existing_ref(struct ref_store *refs, const char *oldref,
2627 const char *newref, const char *logmsg)
2628 {
@@ -2827,8 +2634,3 @@ int refs_copy_existing_ref(struct ref_store *refs, const char *oldref,
2634 free(msg);
2635 return retval;
2636 }
2830 -
2831 -int copy_existing_ref(const char *oldref, const char *newref, const char *logmsg)
2832 -{
2833 - return refs_copy_existing_ref(get_main_ref_store(the_repository), oldref, newref, logmsg);
2834 -}
refs.h
+209 -70
@@ -72,22 +72,14 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
72 struct object_id *oid,
73 int *flags);
74
75 -const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
76 - struct object_id *oid, int *flags);
77 -
75 char *refs_resolve_refdup(struct ref_store *refs,
76 const char *refname, int resolve_flags,
77 struct object_id *oid, int *flags);
81 -char *resolve_refdup(const char *refname, int resolve_flags,
82 - struct object_id *oid, int *flags);
78
79 int refs_read_ref_full(struct ref_store *refs, const char *refname,
80 int resolve_flags, struct object_id *oid, int *flags);
86 -int read_ref_full(const char *refname, int resolve_flags,
87 - struct object_id *oid, int *flags);
81
82 int refs_read_ref(struct ref_store *refs, const char *refname, struct object_id *oid);
90 -int read_ref(const char *refname, struct object_id *oid);
83
84 int refs_read_symbolic_ref(struct ref_store *ref_store, const char *refname,
85 struct strbuf *referent);
@@ -118,8 +110,6 @@ int refs_verify_refname_available(struct ref_store *refs,
110
111 int refs_ref_exists(struct ref_store *refs, const char *refname);
112
121 -int ref_exists(const char *refname);
122 -
113 int should_autocreate_reflog(const char *refname);
114
115 int is_branch(const char *refname);
@@ -334,18 +324,6 @@ int refs_for_each_branch_ref(struct ref_store *refs,
324 int refs_for_each_remote_ref(struct ref_store *refs,
325 each_ref_fn fn, void *cb_data);
326
337 -/* just iterates the head ref. */
338 -int head_ref(each_ref_fn fn, void *cb_data);
339 -
340 -/* iterates all refs. */
341 -int for_each_ref(each_ref_fn fn, void *cb_data);
342 -
343 -/**
344 - * iterates all refs which have a defined prefix and strips that prefix from
345 - * the passed variable refname.
346 - */
347 -int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data);
348 -
327 /*
328 * references matching any pattern in "exclude_patterns" are omitted from the
329 * result set on a best-effort basis.
@@ -353,8 +331,6 @@ int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data);
331 int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix,
332 const char **exclude_patterns,
333 each_ref_fn fn, void *cb_data);
356 -int for_each_fullref_in(const char *prefix, const char **exclude_patterns,
357 - each_ref_fn fn, void *cb_data);
334
335 /**
336 * iterate all refs in "patterns" by partitioning patterns into disjoint sets
@@ -374,23 +350,16 @@ int refs_for_each_fullref_in_prefixes(struct ref_store *refs,
350 /**
351 * iterate refs from the respective area.
352 */
377 -int for_each_tag_ref(each_ref_fn fn, void *cb_data);
378 -int for_each_branch_ref(each_ref_fn fn, void *cb_data);
379 -int for_each_remote_ref(each_ref_fn fn, void *cb_data);
353 int for_each_replace_ref(struct repository *r, each_repo_ref_fn fn, void *cb_data);
354
355 /* iterates all refs that match the specified glob pattern. */
356 int refs_for_each_glob_ref(struct ref_store *refs, each_ref_fn fn,
357 const char *pattern, void *cb_data);
385 -int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data);
358
359 int refs_for_each_glob_ref_in(struct ref_store *refs, each_ref_fn fn,
360 const char *pattern, const char *prefix, void *cb_data);
389 -int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
390 - const char *prefix, void *cb_data);
361
362 int refs_head_ref_namespaced(struct ref_store *refs, each_ref_fn fn, void *cb_data);
393 -int head_ref_namespaced(each_ref_fn fn, void *cb_data);
363
364 /*
365 * references matching any pattern in "exclude_patterns" are omitted from the
@@ -399,12 +368,9 @@ int head_ref_namespaced(each_ref_fn fn, void *cb_data);
368 int refs_for_each_namespaced_ref(struct ref_store *refs,
369 const char **exclude_patterns,
370 each_ref_fn fn, void *cb_data);
402 -int for_each_namespaced_ref(const char **exclude_patterns,
403 - each_ref_fn fn, void *cb_data);
371
372 /* can be used to learn about broken ref and symref */
373 int refs_for_each_rawref(struct ref_store *refs, each_ref_fn fn, void *cb_data);
407 -int for_each_rawref(each_ref_fn fn, void *cb_data);
374
375 /*
376 * Iterates over all refs including root refs, i.e. pseudorefs and HEAD.
@@ -460,7 +426,6 @@ int refs_pack_refs(struct ref_store *refs, struct pack_refs_opts *opts);
426 */
427 int refs_create_reflog(struct ref_store *refs, const char *refname,
428 struct strbuf *err);
463 -int safe_create_reflog(const char *refname, struct strbuf *err);
429
430 /**
431 * Reads log for the value of ref during at_time (in which case "cnt" should be
@@ -484,7 +449,6 @@ int read_ref_at(struct ref_store *refs,
449
450 /** Check if a particular reflog exists */
451 int refs_reflog_exists(struct ref_store *refs, const char *refname);
487 -int reflog_exists(const char *refname);
452
453 /*
454 * Delete the specified reference. If old_oid is non-NULL, then
@@ -498,8 +462,6 @@ int refs_delete_ref(struct ref_store *refs, const char *msg,
462 const char *refname,
463 const struct object_id *old_oid,
464 unsigned int flags);
501 -int delete_ref(const char *msg, const char *refname,
502 - const struct object_id *old_oid, unsigned int flags);
465
466 /*
467 * Delete the specified references. If there are any problems, emit
@@ -509,12 +471,9 @@ int delete_ref(const char *msg, const char *refname,
471 */
472 int refs_delete_refs(struct ref_store *refs, const char *msg,
473 struct string_list *refnames, unsigned int flags);
512 -int delete_refs(const char *msg, struct string_list *refnames,
513 - unsigned int flags);
474
475 /** Delete a reflog */
476 int refs_delete_reflog(struct ref_store *refs, const char *refname);
517 -int delete_reflog(const char *refname);
477
478 /*
479 * Callback to process a reflog entry found by the iteration functions (see
@@ -560,17 +519,7 @@ int refs_for_each_reflog_ent_reverse(struct ref_store *refs,
519 void *cb_data);
520
521 /*
563 - * Iterate over reflog entries in the log for `refname` in the main ref store.
564 - */
565 -
566 -/* oldest entry first */
567 -int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn, void *cb_data);
568 -
569 -/* youngest entry first */
570 -int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn, void *cb_data);
571 -
572 -/*
573 - * The signature for the callback function for the {refs_,}for_each_reflog()
522 + * The signature for the callback function for the refs_for_each_reflog()
523 * functions below. The memory pointed to by the refname argument is only
524 * guaranteed to be valid for the duration of a single callback invocation.
525 */
@@ -581,7 +530,6 @@ typedef int each_reflog_fn(const char *refname, void *cb_data);
530 * and returns the value. Reflog file order is unspecified.
531 */
532 int refs_for_each_reflog(struct ref_store *refs, each_reflog_fn fn, void *cb_data);
584 -int for_each_reflog(each_reflog_fn fn, void *cb_data);
533
534 #define REFNAME_ALLOW_ONELEVEL 1
535 #define REFNAME_REFSPEC_PATTERN 2
@@ -606,23 +554,17 @@ const char *prettify_refname(const char *refname);
554
555 char *refs_shorten_unambiguous_ref(struct ref_store *refs,
556 const char *refname, int strict);
609 -char *shorten_unambiguous_ref(const char *refname, int strict);
557
558 /** rename ref, return 0 on success **/
559 int refs_rename_ref(struct ref_store *refs, const char *oldref,
560 const char *newref, const char *logmsg);
614 -int rename_ref(const char *oldref, const char *newref,
615 - const char *logmsg);
561
562 /** copy ref, return 0 on success **/
563 int refs_copy_existing_ref(struct ref_store *refs, const char *oldref,
564 const char *newref, const char *logmsg);
620 -int copy_existing_ref(const char *oldref, const char *newref,
621 - const char *logmsg);
565
566 int refs_create_symref(struct ref_store *refs, const char *refname,
567 const char *target, const char *logmsg);
625 -int create_symref(const char *refname, const char *target, const char *logmsg);
568
569 enum action_on_err {
570 UPDATE_REFS_MSG_ON_ERR,
@@ -636,7 +578,6 @@ enum action_on_err {
578 */
579 struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
580 struct strbuf *err);
639 -struct ref_transaction *ref_transaction_begin(struct strbuf *err);
581
582 /*
583 * Reference transaction updates
@@ -867,9 +808,6 @@ void ref_transaction_free(struct ref_transaction *transaction);
808 int refs_update_ref(struct ref_store *refs, const char *msg, const char *refname,
809 const struct object_id *new_oid, const struct object_id *old_oid,
810 unsigned int flags, enum action_on_err onerr);
870 -int update_ref(const char *msg, const char *refname,
871 - const struct object_id *new_oid, const struct object_id *old_oid,
872 - unsigned int flags, enum action_on_err onerr);
811
812 int parse_hide_refs_config(const char *var, const char *value, const char *,
813 struct strvec *);
@@ -927,7 +865,7 @@ enum expire_reflog_flags {
865
866 /*
867 * The following interface is used for reflog expiration. The caller
930 - * calls reflog_expire(), supplying it with three callback functions,
868 + * calls refs_reflog_expire(), supplying it with three callback functions,
869 * of the following types. The callback functions define the
870 * expiration policy that is desired.
871 *
@@ -964,12 +902,6 @@ int refs_reflog_expire(struct ref_store *refs,
902 reflog_expiry_should_prune_fn should_prune_fn,
903 reflog_expiry_cleanup_fn cleanup_fn,
904 void *policy_cb_data);
967 -int reflog_expire(const char *refname,
968 - unsigned int flags,
969 - reflog_expiry_prepare_fn prepare_fn,
970 - reflog_expiry_should_prune_fn should_prune_fn,
971 - reflog_expiry_cleanup_fn cleanup_fn,
972 - void *policy_cb_data);
905
906 struct ref_store *get_main_ref_store(struct repository *r);
907
@@ -1068,4 +1000,211 @@ void update_ref_namespace(enum ref_namespace namespace, char *ref);
1000 int is_pseudoref(struct ref_store *refs, const char *refname);
1001 int is_headref(struct ref_store *refs, const char *refname);
1002
1003 +/*
1004 + * The following functions have been removed in Git v2.45 in favor of functions
1005 + * that receive a `ref_store` as parameter. The intent of this section is
1006 + * merely to help patch authors of in-flight series to have a reference what
1007 + * they should be migrating to. The section will be removed in Git v2.46.
1008 + */
1009 +#if 0
1010 +static char *resolve_refdup(const char *refname, int resolve_flags,
1011 + struct object_id *oid, int *flags)
1012 +{
1013 + return refs_resolve_refdup(get_main_ref_store(the_repository),
1014 + refname, resolve_flags,
1015 + oid, flags);
1016 +}
1017 +
1018 +static int read_ref_full(const char *refname, int resolve_flags,
1019 + struct object_id *oid, int *flags)
1020 +{
1021 + return refs_read_ref_full(get_main_ref_store(the_repository), refname,
1022 + resolve_flags, oid, flags);
1023 +}
1024 +
1025 +static int read_ref(const char *refname, struct object_id *oid)
1026 +{
1027 + return refs_read_ref(get_main_ref_store(the_repository), refname, oid);
1028 +}
1029 +
1030 +static int ref_exists(const char *refname)
1031 +{
1032 + return refs_ref_exists(get_main_ref_store(the_repository), refname);
1033 +}
1034 +
1035 +static int for_each_tag_ref(each_ref_fn fn, void *cb_data)
1036 +{
1037 + return refs_for_each_tag_ref(get_main_ref_store(the_repository), fn, cb_data);
1038 +}
1039 +
1040 +static int for_each_branch_ref(each_ref_fn fn, void *cb_data)
1041 +{
1042 + return refs_for_each_branch_ref(get_main_ref_store(the_repository), fn, cb_data);
1043 +}
1044 +
1045 +static int for_each_remote_ref(each_ref_fn fn, void *cb_data)
1046 +{
1047 + return refs_for_each_remote_ref(get_main_ref_store(the_repository), fn, cb_data);
1048 +}
1049 +
1050 +static int head_ref_namespaced(each_ref_fn fn, void *cb_data)
1051 +{
1052 + return refs_head_ref_namespaced(get_main_ref_store(the_repository),
1053 + fn, cb_data);
1054 +}
1055 +
1056 +static int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
1057 + const char *prefix, void *cb_data)
1058 +{
1059 + return refs_for_each_glob_ref_in(get_main_ref_store(the_repository),
1060 + fn, pattern, prefix, cb_data);
1061 +}
1062 +
1063 +static int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
1064 +{
1065 + return refs_for_each_glob_ref(get_main_ref_store(the_repository),
1066 + fn, pattern, cb_data);
1067 +}
1068 +
1069 +static int delete_ref(const char *msg, const char *refname,
1070 + const struct object_id *old_oid, unsigned int flags)
1071 +{
1072 + return refs_delete_ref(get_main_ref_store(the_repository), msg, refname,
1073 + old_oid, flags);
1074 +}
1075 +
1076 +static struct ref_transaction *ref_transaction_begin(struct strbuf *err)
1077 +{
1078 + return ref_store_transaction_begin(get_main_ref_store(the_repository), err);
1079 +}
1080 +
1081 +static int update_ref(const char *msg, const char *refname,
1082 + const struct object_id *new_oid,
1083 + const struct object_id *old_oid,
1084 + unsigned int flags, enum action_on_err onerr)
1085 +{
1086 + return refs_update_ref(get_main_ref_store(the_repository), msg, refname, new_oid,
1087 + old_oid, flags, onerr);
1088 +}
1089 +
1090 +static char *shorten_unambiguous_ref(const char *refname, int strict)
1091 +{
1092 + return refs_shorten_unambiguous_ref(get_main_ref_store(the_repository),
1093 + refname, strict);
1094 +}
1095 +
1096 +static int head_ref(each_ref_fn fn, void *cb_data)
1097 +{
1098 + return refs_head_ref(get_main_ref_store(the_repository), fn, cb_data);
1099 +}
1100 +
1101 +static int for_each_ref(each_ref_fn fn, void *cb_data)
1102 +{
1103 + return refs_for_each_ref(get_main_ref_store(the_repository), fn, cb_data);
1104 +}
1105 +
1106 +static int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data)
1107 +{
1108 + return refs_for_each_ref_in(get_main_ref_store(the_repository), prefix, fn, cb_data);
1109 +}
1110 +
1111 +static int for_each_fullref_in(const char *prefix,
1112 + const char **exclude_patterns,
1113 + each_ref_fn fn, void *cb_data)
1114 +{
1115 + return refs_for_each_fullref_in(get_main_ref_store(the_repository),
1116 + prefix, exclude_patterns, fn, cb_data);
1117 +}
1118 +
1119 +static int for_each_namespaced_ref(const char **exclude_patterns,
1120 + each_ref_fn fn, void *cb_data)
1121 +{
1122 + return refs_for_each_namespaced_ref(get_main_ref_store(the_repository),
1123 + exclude_patterns, fn, cb_data);
1124 +}
1125 +
1126 +static int for_each_rawref(each_ref_fn fn, void *cb_data)
1127 +{
1128 + return refs_for_each_rawref(get_main_ref_store(the_repository), fn, cb_data);
1129 +}
1130 +
1131 +static const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
1132 + struct object_id *oid, int *flags)
1133 +{
1134 + return refs_resolve_ref_unsafe(get_main_ref_store(the_repository), refname,
1135 + resolve_flags, oid, flags);
1136 +}
1137 +
1138 +static int create_symref(const char *ref_target, const char *refs_heads_master,
1139 + const char *logmsg)
1140 +{
1141 + return refs_create_symref(get_main_ref_store(the_repository), ref_target,
1142 + refs_heads_master, logmsg);
1143 +}
1144 +
1145 +static int for_each_reflog(each_reflog_fn fn, void *cb_data)
1146 +{
1147 + return refs_for_each_reflog(get_main_ref_store(the_repository), fn, cb_data);
1148 +}
1149 +
1150 +static int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn,
1151 + void *cb_data)
1152 +{
1153 + return refs_for_each_reflog_ent_reverse(get_main_ref_store(the_repository),
1154 + refname, fn, cb_data);
1155 +}
1156 +
1157 +static int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn,
1158 + void *cb_data)
1159 +{
1160 + return refs_for_each_reflog_ent(get_main_ref_store(the_repository), refname,
1161 + fn, cb_data);
1162 +}
1163 +
1164 +static int reflog_exists(const char *refname)
1165 +{
1166 + return refs_reflog_exists(get_main_ref_store(the_repository), refname);
1167 +}
1168 +
1169 +static int safe_create_reflog(const char *refname, struct strbuf *err)
1170 +{
1171 + return refs_create_reflog(get_main_ref_store(the_repository), refname,
1172 + err);
1173 +}
1174 +
1175 +static int delete_reflog(const char *refname)
1176 +{
1177 + return refs_delete_reflog(get_main_ref_store(the_repository), refname);
1178 +}
1179 +
1180 +static int reflog_expire(const char *refname,
1181 + unsigned int flags,
1182 + reflog_expiry_prepare_fn prepare_fn,
1183 + reflog_expiry_should_prune_fn should_prune_fn,
1184 + reflog_expiry_cleanup_fn cleanup_fn,
1185 + void *policy_cb_data)
1186 +{
1187 + return refs_reflog_expire(get_main_ref_store(the_repository),
1188 + refname, flags,
1189 + prepare_fn, should_prune_fn,
1190 + cleanup_fn, policy_cb_data);
1191 +}
1192 +
1193 +static int delete_refs(const char *msg, struct string_list *refnames,
1194 + unsigned int flags)
1195 +{
1196 + return refs_delete_refs(get_main_ref_store(the_repository), msg, refnames, flags);
1197 +}
1198 +
1199 +static int rename_ref(const char *oldref, const char *newref, const char *logmsg)
1200 +{
1201 + return refs_rename_ref(get_main_ref_store(the_repository), oldref, newref, logmsg);
1202 +}
1203 +
1204 +static int copy_existing_ref(const char *oldref, const char *newref, const char *logmsg)
1205 +{
1206 + return refs_copy_existing_ref(get_main_ref_store(the_repository), oldref, newref, logmsg);
1207 +}
1208 +#endif
1209 +
1210 #endif /* REFS_H */