From: Junio C Hamano <gitster@pobox.com>
To: Meet Soni <meetsoni3017@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [GSoC][PATCH] remote: relocate valid_remote_name
Date: Tue, 04 Feb 2025 06:38:07 -0800 [thread overview]
Message-ID: <xmqqr04dvkq8.fsf@gitster.g> (raw)
In-Reply-To: <20250204041430.36035-1-meetsoni3017@gmail.com> (Meet Soni's message of "Tue, 4 Feb 2025 09:44:30 +0530")
Meet Soni <meetsoni3017@gmail.com> writes:
> Move the `valid_remote_name()` function from `refspec.h` to `remote.h` to
> better align with the separation of concerns.
>
> Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
> ---
> Junio mentioned in [1], the `valid_remote_name` function belongs in remote
> header. This patch addresses that.
>
> [1]: https://lore.kernel.org/git/xmqqikq0ruuk.fsf@gitster.g/
> 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)
> {
This cuts both ways, though. As valid_remote_name() is the only
external caller of valid_fetch_refspec(), without this patch, the
former function can become a file-scope static in refspec.c, but
with this patch in place, it has to stay to be public.
I do see how valid_remote_name() would be useful as a public
function, but I do not know how useful valid_fetch_refspec() is, as
a part of external refspec API. There is no reason other than that
it gives us a handy way to implement valid_remote_name() for it to
exist.
So I dunno.
Thanks.
prev parent reply other threads:[~2025-02-04 14:38 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 ` [GSoC][PATCH v2] " Meet Soni
2025-02-04 14:48 ` Patrick Steinhardt
2025-02-04 14:38 ` Junio C Hamano [this message]
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=xmqqr04dvkq8.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=meetsoni3017@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.