From f21ea69d945f958704f2fe143c2638ecae6e0d12 Mon Sep 17 00:00:00 2001 From: Meet Soni Date: Tue, 4 Feb 2025 19:58:52 +0530 Subject: remote: relocate valid_remote_name Move the `valid_remote_name()` function from the refspec subsystem to the remote subsystem to better align with the separation of concerns. Signed-off-by: Meet Soni Signed-off-by: Junio C Hamano --- remote.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'remote.c') diff --git a/remote.c b/remote.c index 1779f0e7bb..2217eb0a3f 100644 --- a/remote.c +++ b/remote.c @@ -3029,3 +3029,13 @@ char *relative_url(const char *remote_url, const char *url, free(out); return strbuf_detach(&sb, NULL); } + +int valid_remote_name(const char *name) +{ + int result; + struct strbuf refspec = STRBUF_INIT; + strbuf_addf(&refspec, "refs/heads/test:refs/remotes/%s/test", name); + result = valid_fetch_refspec(refspec.buf); + strbuf_release(&refspec); + return result; +} -- cgit 1.2.3-korg