{"thread":{"id":"2964","subject":"[PATCH] Ignore tags that contain colons in their names","startedAt":"2006-01-04T13:13:46Z","lastAt":"2006-01-06T22:37:57Z","messageCount":2,"participants":["Simon Richter","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"14163","messageId":"43BBCA0A.6020906@kleinhenz.de","threadId":"2964","inReplyTo":null,"subject":"[PATCH] Ignore tags that contain colons in their names","fromName":"Simon Richter","fromEmail":"simon.richter@kleinhenz.de","sentAt":"2006-01-04T13:13:46Z","receivedAt":"2006-01-04T13:13:46Z","isPatch":true,"sender":{"key":"simon.richter@kleinhenz.de","avatar":null},"body":"Hi,\n\na repo I was trying to clone contained a tag that somehow had a colon in \nits name, which is illegal. The attached patch makes git-fetch ignore \nthese tags rather than barf.\n\n    Simon\n\n\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 125bcea..6d930b2 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -191,6 +191,7 @@ then\n \ttaglist=$(git-ls-remote --tags \"$remote\" |\n \t\tsed -e '\n \t\t\t/\\^/d\n+\t\t\t/:/d\n \t\t\ts/^[^\t]*\t//\n \t\t\ts/.*/.&:&/')\n \tif test \"$#\" -gt 1\n"},{"id":"14212","messageId":"7v1wzlrni2.fsf@assigned-by-dhcp.cox.net","threadId":"2964","inReplyTo":"43BBCA0A.6020906@kleinhenz.de","subject":"Re: [PATCH] Ignore tags that contain colons in their names","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-06T22:37:57Z","receivedAt":"2006-01-06T22:37:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Simon Richter <Simon.Richter@kleinhenz.de> writes:\n\n> a repo I was trying to clone contained a tag that somehow had a colon\n> in its name, which is illegal. The attached patch makes git-fetch\n> ignore these tags rather than barf.\n\nGood intentions, but colon is not the only character.\nI suspect we need to do something like this instead.\n\n---\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 125bcea..b46b3e5 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -188,11 +188,20 @@ esac\n reflist=$(get_remote_refs_for_fetch \"$@\")\n if test \"$tags\"\n then\n-\ttaglist=$(git-ls-remote --tags \"$remote\" |\n-\t\tsed -e '\n-\t\t\t/\\^/d\n-\t\t\ts/^[^\t]*\t//\n-\t\t\ts/.*/.&:&/')\n+\ttaglist=$(IFS=\"\t\" &&\n+\t\t  git-ls-remote --tags \"$remote\" |\n+\t          while read sha1 name\n+\t\t  do\n+\t\t\tcase \"$name\" in\n+\t\t\t(*^*) continue ;;\n+\t\t\tesac\n+\t\t  \tif git-check-ref-format \"$name\"\n+\t\t\tthen\n+\t\t\t    echo \".${name}:${name}\"\n+\t\t\telse\n+\t\t\t    echo >&2 \"warning: tag ${name} ignored\"\n+\t\t\tfi\n+\t\t  done)\n \tif test \"$#\" -gt 1\n \tthen\n \t\t# remote URL plus explicit refspecs; we need to merge them.\n"}]}