diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-03-25 21:15:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-25 21:55:38 -0700 |
commit | 7d19da46fd108ec463e555cb9fd9efd13b582d4a (patch) | |
tree | 5d71aba8a385380aaafbaba294b12d7679da30b9 /remote.c | |
parent | 5cc8f372509298d13632d8784bc851a587937550 (diff) | |
download | git-7d19da46fd108ec463e555cb9fd9efd13b582d4a.tar.gz |
refspec: allow colon-less wildcard "refs/category/*"
"git push --tags elsewhere" is implemented in terms of wildcarded refspec
"refs/tags/*" these days, and the user wants to push the tags under the
same name to the other branch. This resurrects the support for it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r-- | remote.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -417,17 +417,21 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp rhs++; rlen = strlen(rhs); is_glob = (2 <= rlen && !strcmp(rhs + rlen - 2, "/*")); - rs[i].dst = xstrndup(rhs, rlen - is_glob * 2); + if (is_glob) + rlen -= 2; + rs[i].dst = xstrndup(rhs, rlen); } llen = (rhs ? (rhs - lhs - 1) : strlen(lhs)); - if (is_glob != (2 <= llen && !memcmp(lhs + llen - 2, "/*", 2))) - goto invalid; - - if (is_glob) { + if (2 <= llen && !memcmp(lhs + llen - 2, "/*", 2)) { + if ((rhs && !is_glob) || (!rhs && fetch)) + goto invalid; + is_glob = 1; llen -= 2; - rlen -= 2; + } else if (rhs && is_glob) { + goto invalid; } + rs[i].pattern = is_glob; rs[i].src = xstrndup(lhs, llen); @@ -446,7 +450,7 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp } /* * RHS - * - missing is allowed. + * - missing is ok, and is same as empty. * - empty is ok; it means not to store. * - otherwise it must be a valid looking ref. */ |