Skip to content

Commit f21ea69

Browse files
inosmeetgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc204b7 commit f21ea69

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

refspec.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,6 @@ int valid_fetch_refspec(const char *fetch_refspec_str)
236236
return ret;
237237
}
238238

239-
int valid_remote_name(const char *name)
240-
{
241-
int result;
242-
struct strbuf refspec = STRBUF_INIT;
243-
strbuf_addf(&refspec, "refs/heads/test:refs/remotes/%s/test", name);
244-
result = valid_fetch_refspec(refspec.buf);
245-
strbuf_release(&refspec);
246-
return result;
247-
}
248-
249239
void refspec_ref_prefixes(const struct refspec *rs,
250240
struct strvec *ref_prefixes)
251241
{

refspec.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ void refspec_appendn(struct refspec *rs, const char **refspecs, int nr);
6161
void refspec_clear(struct refspec *rs);
6262

6363
int valid_fetch_refspec(const char *refspec);
64-
int valid_remote_name(const char *name);
6564

6665
struct strvec;
6766
/*

remote.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,3 +3029,13 @@ char *relative_url(const char *remote_url, const char *url,
30293029
free(out);
30303030
return strbuf_detach(&sb, NULL);
30313031
}
3032+
3033+
int valid_remote_name(const char *name)
3034+
{
3035+
int result;
3036+
struct strbuf refspec = STRBUF_INIT;
3037+
strbuf_addf(&refspec, "refs/heads/test:refs/remotes/%s/test", name);
3038+
result = valid_fetch_refspec(refspec.buf);
3039+
strbuf_release(&refspec);
3040+
return result;
3041+
}

remote.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,4 +463,6 @@ void apply_push_cas(struct push_cas_option *, struct remote *, struct ref *);
463463
char *relative_url(const char *remote_url, const char *url,
464464
const char *up_path);
465465

466+
int valid_remote_name(const char *name);
467+
466468
#endif

0 commit comments

Comments
 (0)