From 91e2ab1587d8ee18e3d2978f2b7bc250faf5df8f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 13 Dec 2022 06:11:10 -0500 Subject: ls-refs: use repository parameter to iterate refs The ls_refs() function (for the v2 protocol command of the same name) takes a repository parameter (like all v2 commands), but ignores it. It should use it to access the refs. This isn't a bug in practice, since we only call this function when serving upload-pack from the main repository. But it's an awkward gotcha, and it causes -Wunused-parameter to complain. The main reason we don't use the repository parameter is that the ref iteration interface we call doesn't have a "refs_" variant that takes a ref_store. However we can easily add one. In fact, since there is only one other caller (in ref-filter.c), there is no need to maintain the non-repository wrapper; that caller can just use the_repository. It's still a long way from consistently using a repository object, but it's one small step in the right direction. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- ls-refs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ls-refs.c') diff --git a/ls-refs.c b/ls-refs.c index fb6769742c..697d4beb8d 100644 --- a/ls-refs.c +++ b/ls-refs.c @@ -194,8 +194,9 @@ int ls_refs(struct repository *r, struct packet_reader *request) send_possibly_unborn_head(&data); if (!data.prefixes.nr) strvec_push(&data.prefixes, ""); - for_each_fullref_in_prefixes(get_git_namespace(), data.prefixes.v, - send_ref, &data); + refs_for_each_fullref_in_prefixes(get_main_ref_store(r), + get_git_namespace(), data.prefixes.v, + send_ref, &data); packet_fflush(stdout); strvec_clear(&data.prefixes); strbuf_release(&data.buf); -- cgit v1.2.1