Re: tracking repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 16 Mar 2008, Junio C Hamano wrote:

> kenneth johansson <ken@xxxxxxxxx> writes:
> 
> > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> > 	fetch = +refs/heads/*:refs/heads/*
> > [remote "stable_2.6.12"]
> > 	url =
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.12.y.git
> > 	fetch = +refs/heads/*:refs/heads/stable_2.6.12_*
> 
> Daniel, I think we are looking at a regression.  The latter style, * at
> the end but not immediately following a slash, should never have worked.
> Wildcard expansion function should be erroring out when it sees something
> like this.

I'm not sure any older code actually enforced this, either

We don't currently have any concept of an invalid refspec; 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).

Here's a patch to make the pattern logic require a slash before the *:
---------
commit 7aa15c359bcfc7a3c87345435b81ef41e1f59800
Author: Daniel Barkalow <barkalow@xxxxxxxxxxxx>
Date:   Sun Mar 16 17:26:41 2008 -0400

    Require / before * in pattern refspecs
    
    We don't want to have "+refs/heads/*:refs/heads/something_*" match
    "refs/heads/master" to "refs/heads/something_master".
    
    Signed-off-by: Daniel Barkalow <barkalow@xxxxxxxxxxxx>

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;
 		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);
 				else
 					rs[i].dst = xstrdup(ep + 1);
 			}
@@ -424,7 +423,7 @@ struct refspec *parse_ref_spec(int nr_refspec, const char **refspec)
 		}
 		if (gp) {
 			rs[i].pattern = 1;
-			ep = gp;
+			ep = gp + 1;
 		}
 		rs[i].src = xstrndup(sp, ep - sp);
 	}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux