diff options
| author | Patrick Steinhardt <ps@pks.im> | 2026-02-23 12:59:45 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-02-23 13:21:18 -0800 |
| commit | 00be226f1f2a1036ea3920f8700b23b7cc55bf57 (patch) | |
| tree | 34cf7daa6ad015c32e8400fbf99747461cc3c151 /refs.c | |
| parent | 5507200b504f478516bf93767ac3ed3bebed7226 (diff) | |
| download | git-00be226f1f2a1036ea3920f8700b23b7cc55bf57.tar.xz | |
refs: replace `refs_for_each_ref_in()`
Replace calls to `refs_for_each_ref_in()` with the newly introduced
`refs_for_each_ref_ext()` function.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
| -rw-r--r-- | refs.c | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -529,19 +529,31 @@ void refs_warn_dangling_symrefs(struct ref_store *refs, FILE *fp, refs_for_each_rawref(refs, warn_if_dangling_symref, &data); } -int refs_for_each_tag_ref(struct ref_store *refs, refs_for_each_cb fn, void *cb_data) +int refs_for_each_tag_ref(struct ref_store *refs, refs_for_each_cb cb, void *cb_data) { - return refs_for_each_ref_in(refs, "refs/tags/", fn, cb_data); + struct refs_for_each_ref_options opts = { + .prefix = "refs/tags/", + .trim_prefix = strlen("refs/tags/"), + }; + return refs_for_each_ref_ext(refs, cb, cb_data, &opts); } -int refs_for_each_branch_ref(struct ref_store *refs, refs_for_each_cb fn, void *cb_data) +int refs_for_each_branch_ref(struct ref_store *refs, refs_for_each_cb cb, void *cb_data) { - return refs_for_each_ref_in(refs, "refs/heads/", fn, cb_data); + struct refs_for_each_ref_options opts = { + .prefix = "refs/heads/", + .trim_prefix = strlen("refs/heads/"), + }; + return refs_for_each_ref_ext(refs, cb, cb_data, &opts); } -int refs_for_each_remote_ref(struct ref_store *refs, refs_for_each_cb fn, void *cb_data) +int refs_for_each_remote_ref(struct ref_store *refs, refs_for_each_cb cb, void *cb_data) { - return refs_for_each_ref_in(refs, "refs/remotes/", fn, cb_data); + struct refs_for_each_ref_options opts = { + .prefix = "refs/remotes/", + .trim_prefix = strlen("refs/remotes/"), + }; + return refs_for_each_ref_ext(refs, cb, cb_data, &opts); } int refs_head_ref_namespaced(struct ref_store *refs, refs_for_each_cb fn, void *cb_data) @@ -1934,16 +1946,6 @@ int refs_for_each_ref(struct ref_store *refs, refs_for_each_cb cb, void *cb_data return refs_for_each_ref_ext(refs, cb, cb_data, &opts); } -int refs_for_each_ref_in(struct ref_store *refs, const char *prefix, - refs_for_each_cb cb, void *cb_data) -{ - struct refs_for_each_ref_options opts = { - .prefix = prefix, - .trim_prefix = strlen(prefix), - }; - return refs_for_each_ref_ext(refs, cb, cb_data, &opts); -} - int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix, const char **exclude_patterns, refs_for_each_cb cb, void *cb_data) |
