git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Ignore tags that contain colons in their names
@ 2006-01-04 13:13 Simon Richter
  2006-01-06 22:37 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Richter @ 2006-01-04 13:13 UTC (permalink / raw)
  To: git


[-- Attachment #1.1: Type: text/plain, Size: 190 bytes --]

Hi,

a repo I was trying to clone contained a tag that somehow had a colon in 
its name, which is illegal. The attached patch makes git-fetch ignore 
these tags rather than barf.

    Simon

[-- Attachment #1.2: ignore-colon-tags.diff --]
[-- Type: text/plain, Size: 264 bytes --]

diff --git a/git-fetch.sh b/git-fetch.sh
index 125bcea..6d930b2 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -191,6 +191,7 @@ then
 	taglist=$(git-ls-remote --tags "$remote" |
 		sed -e '
 			/\^/d
+			/:/d
 			s/^[^	]*	//
 			s/.*/.&:&/')
 	if test "$#" -gt 1

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 307 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Ignore tags that contain colons in their names
  2006-01-04 13:13 [PATCH] Ignore tags that contain colons in their names Simon Richter
@ 2006-01-06 22:37 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2006-01-06 22:37 UTC (permalink / raw)
  To: Simon Richter; +Cc: git

Simon Richter <Simon.Richter@kleinhenz.de> writes:

> a repo I was trying to clone contained a tag that somehow had a colon
> in its name, which is illegal. The attached patch makes git-fetch
> ignore these tags rather than barf.

Good intentions, but colon is not the only character.
I suspect we need to do something like this instead.

---
diff --git a/git-fetch.sh b/git-fetch.sh
index 125bcea..b46b3e5 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -188,11 +188,20 @@ esac
 reflist=$(get_remote_refs_for_fetch "$@")
 if test "$tags"
 then
-	taglist=$(git-ls-remote --tags "$remote" |
-		sed -e '
-			/\^/d
-			s/^[^	]*	//
-			s/.*/.&:&/')
+	taglist=$(IFS="	" &&
+		  git-ls-remote --tags "$remote" |
+	          while read sha1 name
+		  do
+			case "$name" in
+			(*^*) continue ;;
+			esac
+		  	if git-check-ref-format "$name"
+			then
+			    echo ".${name}:${name}"
+			else
+			    echo >&2 "warning: tag ${name} ignored"
+			fi
+		  done)
 	if test "$#" -gt 1
 	then
 		# remote URL plus explicit refspecs; we need to merge them.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-06 22:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04 13:13 [PATCH] Ignore tags that contain colons in their names Simon Richter
2006-01-06 22:37 ` Junio C Hamano

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).