From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Daniel Barkalow <barkalow@iabervon.org>, git@vger.kernel.org
Subject: fetch refspec foo/* matches foo*
Date: Sat, 26 Jul 2008 04:24:05 -0400 [thread overview]
Message-ID: <20080726082405.GA10104@sigill.intra.peff.net> (raw)
In-Reply-To: <7v1w1hsmnc.fsf@gitster.siamese.dyndns.org>
On Fri, Jul 25, 2008 at 02:02:15PM -0700, Junio C Hamano wrote:
> BTW, has anybody taken a look at this one?
>
> Subject: BUG: fetch incorrect interpretation of globing patterns in refspecs
> Date: Thu, 24 Jul 2008 09:07:21 +0200
> Message-ID: <71295b5a0807240007k246973abj1897895d0d67bb6c@mail.gmail.com>
>
> If not, I think I probably need to take a look at this, reproducing and
> possibly fixing, before applying non-fix patches.
I have been meaning to look at it for days, so I finally took a peek. I
was able to reproduce the problem easily. I think it is (almost) as
simple as the patch below. In the refspec parsing, we already require
globs to come after '/', so this is the analagous check during match.
Unfortunately, this breaks t1020 (something about failing to clone HEAD
it looks like, so probably it is some boundary case for matching just
"*"). I don't have time to look further, and I will be out of touch
until probably Sunday evening, so hopefully somebody else can run with
it.
---
diff --git a/remote.c b/remote.c
index 0d6020b..3ae0431 100644
--- a/remote.c
+++ b/remote.c
@@ -1108,7 +1108,8 @@ static struct ref *get_expanded_map(const struct ref *remote_refs,
for (ref = remote_refs; ref; ref = ref->next) {
if (strchr(ref->name, '^'))
continue; /* a dereference item */
- if (!prefixcmp(ref->name, refspec->src)) {
+ if (!prefixcmp(ref->name, refspec->src)
+ && ref->name[remote_prefix_len] == '/') {
const char *match;
struct ref *cpy = copy_ref(ref);
match = ref->name + remote_prefix_len;
next prev parent reply other threads:[~2008-07-26 8:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 23:13 [PATCH] bash completion: Add completion for 'git help' Lee Marlow
2008-07-24 0:07 ` Lee Marlow
2008-07-25 20:40 ` Shawn O. Pearce
2008-07-25 21:02 ` Junio C Hamano
2008-07-26 8:24 ` Jeff King [this message]
2008-07-26 8:33 ` fetch refspec foo/* matches foo* Jeff King
2008-07-26 13:13 ` [PATCH] init: handle empty "template" parameter, was " Johannes Schindelin
2008-07-28 6:02 ` Jeff King
2008-07-28 6:13 ` Junio C Hamano
2008-07-28 6:16 ` Jeff King
2008-07-27 0:18 ` Junio C Hamano
2008-07-27 6:15 ` [PATCH] make sure parsed wildcard refspec ends with slash Junio C Hamano
2008-07-27 17:20 ` Daniel Barkalow
2008-07-28 5:41 ` Jeff King
2008-07-24 0:08 ` [PATCH] bash completion: Add completion for 'git help' Lee Marlow
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=20080726082405.GA10104@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).