From: Meet Soni <meetsoni3017@gmail.com>
To: git@vger.kernel.org
Cc: ps@pks.im, gitster@pobox.com, Meet Soni <meetsoni3017@gmail.com>
Subject: [GSoC][PATCH v2] remote: relocate valid_remote_name
Date: Tue, 4 Feb 2025 19:58:52 +0530 [thread overview]
Message-ID: <20250204142852.13035-1-meetsoni3017@gmail.com> (raw)
In-Reply-To: <20250204041430.36035-1-meetsoni3017@gmail.com>
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>
---
Range-diff against v1:
1: cbf0f21045 ! 1: 7736bae283 remote: relocate valid_remote_name
@@ Metadata
## Commit message ##
remote: relocate valid_remote_name
- Move the `valid_remote_name()` function from `refspec.h` to `remote.h` to
- better align with the separation of concerns.
+ 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>
refspec.c | 10 ----------
refspec.h | 1 -
remote.c | 10 ++++++++++
remote.h | 2 ++
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/refspec.c b/refspec.c
index 6d86e04442..83ec7d7e62 100644
--- a/refspec.c
+++ b/refspec.c
@@ -236,16 +236,6 @@ 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)
{
diff --git a/refspec.h b/refspec.h
index 69d693c87d..dc428f86f2 100644
--- a/refspec.h
+++ b/refspec.h
@@ -61,7 +61,6 @@ void refspec_appendn(struct refspec *rs, const char **refspecs, int nr);
void refspec_clear(struct refspec *rs);
int valid_fetch_refspec(const char *refspec);
-int valid_remote_name(const char *name);
struct strvec;
/*
diff --git a/remote.c b/remote.c
index 0f6fba8562..3d451570cb 100644
--- a/remote.c
+++ b/remote.c
@@ -3003,3 +3003,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;
+}
diff --git a/remote.h b/remote.h
index bda10dd5c8..0c14d665b6 100644
--- a/remote.h
+++ b/remote.h
@@ -461,4 +461,6 @@ void apply_push_cas(struct push_cas_option *, struct remote *, struct ref *);
char *relative_url(const char *remote_url, const char *url,
const char *up_path);
+int valid_remote_name(const char *name);
+
#endif
--
2.34.1
next prev parent reply other threads:[~2025-02-04 14:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 4:14 [GSoC][PATCH] remote: relocate valid_remote_name Meet Soni
2025-02-04 7:55 ` Patrick Steinhardt
2025-02-04 14:06 ` Meet Soni
2025-02-04 14:47 ` Patrick Steinhardt
2025-02-06 10:14 ` Meet Soni
2025-02-04 14:28 ` Meet Soni [this message]
2025-02-04 14:48 ` [GSoC][PATCH v2] " Patrick Steinhardt
2025-02-04 14:38 ` [GSoC][PATCH] " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250204142852.13035-1-meetsoni3017@gmail.com \
--to=meetsoni3017@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).