{"thread":{"id":"43731","subject":"[PATCH] git-fetch.sh: fix fetching of tags that point directly to commits","startedAt":"2006-11-19T02:59:21Z","lastAt":"2006-11-19T02:59:21Z","messageCount":1,"participants":["Petr 'Patch Proxy' Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"297484","messageId":"20061119025921.GU7201@pasky.or.cz","threadId":"43731","inReplyTo":null,"subject":"[PATCH] git-fetch.sh: fix fetching of tags that point directly to commits","fromName":"Petr 'Patch Proxy' Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2006-11-19T02:59:21Z","receivedAt":"2006-11-19T02:59:21Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"git-fetch used to fetch only tags that pointed to tag objects,\nbecause it required a ^{} suffix from git-ls-remote's output.\n\nNot signed off.\n---\n\nFor similar issue in Cogito, please see\n\n\thttp://news.gmane.org/find-root.php?message_id=<20060427105251.AA4B2353DAC@atlas.denx.de>\n\nCuriously enough, Junio himself posted a patch. Perhaps given his state\nas of then he forgot to fix Git as well. ;-)\n\nI did not write this patch. One fellow IRCer did, but for personal\nreasons he does not wish to disclose his realname. I think the patch is\ntrivial enough that copyright problems should not be a issue.\n\n git-fetch.sh |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 7442dd2..9074b3f 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -430,9 +430,13 @@ case \"$no_tags$tags\" in\n \t*:refs/*)\n \t\t# effective only when we are following remote branch\n \t\t# using local tracking branch.\n-\t\ttaglist=$(IFS=\" \" &&\n+\t\t# If we get both refs/tags/foo and refs/tags/foo^{},\n+\t\t# use only the latter and strip the ^{} suffix.\n+\t\ttaglist=$(\n+\t\tIFS=\" \"; export LC_COLLATE=C\n \t\tgit-ls-remote $upload_pack --tags \"$remote\" |\n-\t\tsed -ne 's|^\\([0-9a-f]*\\)[ \t]\\(refs/tags/.*\\)^{}$|\\1 \\2|p' |\n+\t\tsed -ne 's|^\\([0-9a-f]*\\)[ \\t]\\(refs/tags/.*\\)$|\\1 \\2|p' |\n+\t\tsort -k2 -r | sed -e 's/\\^{}$//' | uniq -f1 |\n \t\twhile read sha1 name\n \t\tdo\n \t\t\tgit-show-ref --verify --quiet -- $name && continue\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nThe meaning of Stonehenge in Traflamadorian, when viewed from above, is:\n\"Replacement part being rushed with all possible speed.\"\n"}]}