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: [ref]
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;