git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] git-fetch: do not use "*" for fetching multiple refs

From
MLMichael Loeffler <loeffler@ls-itc.de>
Date
Dec 4, 2006, 19:38 UTC
Message-ID
<1165261102.20055.9.camel@ibook.zvpunry.de>

The trailing / is enough to decide if this should map everything under refs/heads/ to refs/somewhere/.

The "*" should be reserved for the use as regex operator.
Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
---
I want to use regular expressions to match remote refs, so I try to
implement this. But the current globfetch syntax needs the '*'.
Maybe it is not to late to change the syntax to this:
Pull: refs/heads/:refs/remotes/origin/
What do you think?
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index da064a5..38af4cb 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -101,13 +101,13 @@ expand_refs_wildcard () {
 	do
 		lref=${ref#'+'}
 		# a non glob pattern is given back as-is.
-		expr "z$lref" : 'zrefs/.*/\*:refs/.*/\*$' >/dev/null || {
+		expr "z$lref" : 'zrefs/.*/:refs/.*/$' >/dev/null || {
 			echo "$ref"
 			continue
 		}
 
-		from=`expr "z$lref" : 'z\(refs/.*/\)\*:refs/.*/\*$'`
-		to=`expr "z$lref" : 'zrefs/.*/\*:\(refs/.*/\)\*$'`
+		from=`expr "z$lref" : 'z\(refs/.*/\):refs/.*/$'`
+		to=`expr "z$lref" : 'zrefs/.*/:\(refs/.*/\)$'`
 		local_force=
 		test "z$lref" = "z$ref" || local_force='+'
 		echo "$ls_remote_result" |
-- 
1.4.4
Next: Jakub Narebski
Message 1 of 11 in “git-fetch: do not use "*" for fetching multiple refs”
  1. 2/3 git-fetch: do not use "*" for fetching multiple refsMichael Loeffler, Dec 4, 2006
  2. Jakub NarebskiDec 4, 2006
  3. Michael LoefflerDec 6, 2006
  4. Jakub NarebskiDec 6, 2006
  5. Michael LoefflerDec 6, 2006
  6. Jakub NarebskiDec 6, 2006
  7. Junio C HamanoDec 6, 2006
  8. Junio C HamanoDec 6, 2006
  9. Johannes SchindelinDec 6, 2006
  10. Jakub NarebskiDec 6, 2006
  11. Michael LoefflerDec 4, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.