From: Junio C Hamano <gitster@pobox.com>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: git@vger.kernel.org, kenneth johansson <ken@kenjo.org>
Subject: Re: tracking repository
Date: Sun, 16 Mar 2008 17:35:31 -0700 [thread overview]
Message-ID: <7vlk4ichm4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LNX.1.00.0803161716470.19665@iabervon.org> (Daniel Barkalow's message of "Sun, 16 Mar 2008 17:28:36 -0400 (EDT)")
Daniel Barkalow <barkalow@iabervon.org> writes:
> We don't currently have any concept of an invalid refspec;
We don't? or just that parse_ref_spec() does not detect one?
> ... we just have
> things that fall back to not being patterns and not being possible to
> match (due to one or the other side being invalid as a ref name).
I am afraid that is an invitation for more bugs and confusions.
It probably is not too late to fix this; users would rather want to see
their misconfigurations clearly flagged as such, rather than the code
letting bogosity through silently and doing something that does not
exactly match what they configured.
> diff --git a/remote.c b/remote.c
> index f3f7375..fffde34 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -404,18 +404,17 @@ struct refspec *parse_ref_spec(int nr_refspec, const char **refspec)
> rs[i].force = 1;
> sp++;
> }
> - gp = strchr(sp, '*');
> + gp = strstr(sp, "/*");
> ep = strchr(sp, ':');
> if (gp && ep && gp > ep)
> gp = NULL;
How would this trigger? We find * (or /*) but that is the one on the LHS,
which means the spec was like "refs/heads/foobar:refs/remotes/origin/*",
and it makes me wonder if we should mark this as an configuration error.
Did erroring out on "gp && ep && gp > ep" here have issues (i.e. reject a
valid configuration)?
> if (ep) {
> if (ep[1]) {
> - const char *glob = strchr(ep + 1, '*');
> + const char *glob = strstr(ep + 1, "/*");
> if (!glob)
> gp = NULL;
> if (gp)
> - rs[i].dst = xstrndup(ep + 1,
> - glob - ep - 1);
> + rs[i].dst = xstrndup(ep + 1, glob - ep);
This truncates "refs/heads/*:refs/remotes/origin/*/bar" as if it did not
have "/bar" without any error indication. The same questions apply.
next prev parent reply other threads:[~2008-03-17 0:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-15 19:35 tracking repository kenneth johansson
2008-03-16 2:42 ` Junio C Hamano
2008-03-16 20:02 ` kenneth johansson
2008-03-16 20:38 ` Junio C Hamano
2008-03-16 21:28 ` Daniel Barkalow
2008-03-16 21:57 ` Junio C Hamano
2008-03-16 22:18 ` Daniel Barkalow
2008-03-16 22:30 ` Junio C Hamano
2008-03-16 23:01 ` Junio C Hamano
2008-03-16 23:11 ` Daniel Barkalow
2008-03-17 0:17 ` Junio C Hamano
2008-03-17 0:35 ` Junio C Hamano [this message]
2008-03-17 2:13 ` Daniel Barkalow
2008-03-17 2:37 ` Daniel Barkalow
2008-03-17 7:48 ` Junio C Hamano
2008-03-17 16:23 ` Daniel Barkalow
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=7vlk4ichm4.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=ken@kenjo.org \
/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