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 <meetsoni3017@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
bc204b7427
commit
f21ea69d94
10
refspec.c
10
refspec.c
@ -236,16 +236,6 @@ int valid_fetch_refspec(const char *fetch_refspec_str)
|
|||||||
return ret;
|
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,
|
void refspec_ref_prefixes(const struct refspec *rs,
|
||||||
struct strvec *ref_prefixes)
|
struct strvec *ref_prefixes)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,6 @@ void refspec_appendn(struct refspec *rs, const char **refspecs, int nr);
|
|||||||
void refspec_clear(struct refspec *rs);
|
void refspec_clear(struct refspec *rs);
|
||||||
|
|
||||||
int valid_fetch_refspec(const char *refspec);
|
int valid_fetch_refspec(const char *refspec);
|
||||||
int valid_remote_name(const char *name);
|
|
||||||
|
|
||||||
struct strvec;
|
struct strvec;
|
||||||
/*
|
/*
|
||||||
|
10
remote.c
10
remote.c
@ -3029,3 +3029,13 @@ char *relative_url(const char *remote_url, const char *url,
|
|||||||
free(out);
|
free(out);
|
||||||
return strbuf_detach(&sb, NULL);
|
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;
|
||||||
|
}
|
||||||
|
2
remote.h
2
remote.h
@ -463,4 +463,6 @@ void apply_push_cas(struct push_cas_option *, struct remote *, struct ref *);
|
|||||||
char *relative_url(const char *remote_url, const char *url,
|
char *relative_url(const char *remote_url, const char *url,
|
||||||
const char *up_path);
|
const char *up_path);
|
||||||
|
|
||||||
|
int valid_remote_name(const char *name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user