{"thread":{"id":"2118","subject":"cg-fetch auto-following tags","startedAt":"2005-10-16T00:58:44Z","lastAt":"2005-10-16T00:58:44Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"10144","messageId":"7vfyr2i8fv.fsf@assigned-by-dhcp.cox.net","threadId":"2118","inReplyTo":null,"subject":"cg-fetch auto-following tags","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-16T00:58:44Z","receivedAt":"2005-10-16T00:58:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"In cg-fetch, you have some code at the bottom starting with:\n\n\t$get -i -s -u -d \"$uri/refs/tags\" \"$_git/refs/tags\" || rsyncerr=1\n\nUnder http, I presume get is get_http which is recursive wget to\nslurp all tags to .git/refs/tags?\n\nEarlier you were talking about fetching tags automatically as\nthe user follows a branch (or multiple branches) development,\nbut the current git-http-fetch's semantics of making sure the\nrepository has all the reachable objects when slurping from a\nref makes it impossible, and you are playing things safer by\nessentially cloning the remote repository.\n\nThe latest \"master\" branch of git-core sends unwrapped tag\ninformation to make this easier to implement.  I think you\nshould be able to do something like this (between \"FIXME: Warn\nabout conflicting tag names?\" and \"rm fetch-$name-dirty\").\n\n        git-ls-remote --tags $uri/ |\n\t# SHA1 refs/tags/v0.99.8^{} --> SHA1 tags/v0.99.8\n\t# where SHA1 is the object v0.99.8 tag points at.\n        sed -ne 's:\\([^\t]\\)\trefs/\\(tags/.*\\)^{}$:\\1\t\\2:p' |\n        while read sha1 tagname\n        do\n\t\t# do we have the object pointed at by the tag?\n                git-cat-file -t \"$sha1\" >/dev/null 2>&1 ||\n                continue\n\n                # if so, fetch the tag -- which should be a\n                # cheap operation -- to complete the chain.\n                $fetch \"$tagname\" \"$uri\" \"$tagname\"\n        done\n\nThis sample code assumes your $fetch implements the same\nsemantics for various transports ($1 is the ref to fetch, $2 is\nthe repo url, $3 is the local ref to write into); I only checked\nhttp transport in your code.\n"}]}