From 1553f5e76c72243f61b454412b651706a869388f Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 1 Mar 2022 10:33:50 +0100 Subject: remote: read symbolic refs via `refs_read_symbolic_ref()` We have two cases in the remote code where we check whether a reference is symbolic or not, but don't mind in case it doesn't exist or in case it exists but is a non-symbolic reference. Convert these two callsites to use the new `refs_read_symbolic_ref()` function, whose intent is to implement exactly that usecase. No change in behaviour is expected from this change. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- builtin/remote.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'builtin/remote.c') diff --git a/builtin/remote.c b/builtin/remote.c index 299c466116..805a517192 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -766,13 +766,15 @@ static int mv(int argc, const char **argv) for_each_ref(read_remote_branches, &rename); for (i = 0; i < remote_branches.nr; i++) { struct string_list_item *item = remote_branches.items + i; - int flag = 0; + struct strbuf referent = STRBUF_INIT; - read_ref_full(item->string, RESOLVE_REF_READING, NULL, &flag); - if (!(flag & REF_ISSYMREF)) + if (refs_read_symbolic_ref(get_main_ref_store(the_repository), item->string, + &referent)) continue; if (delete_ref(NULL, item->string, NULL, REF_NO_DEREF)) die(_("deleting '%s' failed"), item->string); + + strbuf_release(&referent); } for (i = 0; i < remote_branches.nr; i++) { struct string_list_item *item = remote_branches.items + i; -- cgit v1.2.3