Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Barag <sean@barag.org>2020-10-01 06:46:13 +0300
committerJunio C Hamano <gitster@pobox.com>2020-10-01 08:09:13 +0300
commitf2c6fda88624370fda1fc706a0f2ceda7d50d6ab (patch)
tree76a1421ef4a334d6bed9dd455ee1d627bb4c3f2e /refspec.c
parent444825c7c1148c0a38708238467c33ba370c58b2 (diff)
refs: consolidate remote name validation
In preparation for a future patch, extract from remote.c a function that validates possible remote names so that its rules can be used consistently in other places. Helped-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Sean Barag <sean@barag.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refspec.c')
-rw-r--r--refspec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/refspec.c b/refspec.c
index f10ef284ce..98d1caaa0a 100644
--- a/refspec.c
+++ b/refspec.c
@@ -201,6 +201,16 @@ int valid_fetch_refspec(const char *fetch_refspec_str)
return ret;
}
+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;
+}
+
void refspec_ref_prefixes(const struct refspec *rs,
struct strvec *ref_prefixes)
{