From: Junio C Hamano <gitster@pobox.com>
To: Michael Schubert <mschub@elegosoft.com>
Cc: Alex Vandiver <alex@chmrr.net>, git@vger.kernel.org
Subject: Re: [RFC/PATCH] tag: disallow '-' as tag name
Date: Mon, 09 May 2011 16:08:09 -0700 [thread overview]
Message-ID: <7v62pjo4km.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4DC87113.4030204@elegosoft.com> (Michael Schubert's message of "Tue, 10 May 2011 00:56:19 +0200")
Michael Schubert <mschub@elegosoft.com> writes:
> Add strbuf_check_tag_ref() as helper to check a refname for a tag.
>
> Signed-off-by: Michael Schubert <mschub@elegosoft.com>
> ---
That was quick ;-).
> builtin/tag.c | 30 ++++++++++++++++++++++--------
> 1 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/tag.c b/builtin/tag.c
> index b66b34a..f087a7f 100644
> --- a/builtin/tag.c
> +++ b/builtin/tag.c
> @@ -352,11 +352,26 @@ static int parse_msg_arg(const struct option *opt, const char *arg, int unset)
> return 0;
> }
>
> +static int strbuf_check_tag_ref(struct strbuf *sb, const char *name)
> +{
> + if (name[0] == '-')
> + return CHECK_REF_FORMAT_ERROR;
So contrary to what the title claims, it forbids a tag that begins with '-',
e.g. '-foo', not just a single dash. That is fine by me (we do the same
in strbuf-check-branch-ref) but it needs to be explained better.
> + strbuf_reset(sb);
> + strbuf_add(sb, "refs/tags/", 10);
> + strbuf_add(sb, name, strlen(name));
strbuf_addf(sb, "refs/tags/%s", name)?
> + if (sb->len > PATH_MAX)
> + die(_("tag name too long: %.*s..."), 50, name);
I think that should be
if (PATH_MAX <= sb->len)
but I do not see the point of checking against PATH_MAX if you are already
using a strbuf...
next prev parent reply other threads:[~2011-05-09 23:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-09 15:21 Tags named '-' Alex Vandiver
2011-05-09 18:01 ` Junio C Hamano
2011-05-09 22:56 ` [RFC/PATCH] tag: disallow '-' as tag name Michael Schubert
2011-05-09 23:08 ` Junio C Hamano [this message]
2011-05-09 23:36 ` [RFC/PATCH v2] " Michael Schubert
[not found] ` <BANLkTik7PYjGMMfxaNPubYR7M1OgBrF_qw@mail.gmail.com>
2011-05-10 9:47 ` Michael Schubert
2011-05-09 22:04 ` Tags named '-' Sverre Rabbelier
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=7v62pjo4km.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=alex@chmrr.net \
--cc=git@vger.kernel.org \
--cc=mschub@elegosoft.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 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).