{"thread":{"id":"53860","subject":"[BUG?] Fetching a single tag to a local tag requires `--no-tags`","startedAt":"2020-07-15T02:18:06Z","lastAt":"2020-07-15T13:05:43Z","messageCount":3,"participants":["Philippe Blain","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"401570","messageId":"12F0A2A4-CC71-4452-B8B8-F540339F8519@gmail.com","threadId":"53860","inReplyTo":null,"subject":"[BUG?] Fetching a single tag to a local tag requires `--no-tags`","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2020-07-15T02:17:59Z","receivedAt":"2020-07-15T02:18:06Z","isPatch":false,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hello everyone,\n\nIf I want to fetch a single tag from a remote repository to a local tag,\nit seems I have to use `--no-tags`, or else all tags on the remote are fetched:\n\ngit remote add ggg https://github.com/gitgitgadget/git\n# this command fetches all tags on Gitgitgadget\ngit fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2\n# this command fetches only the tag listed on the command line\ngit fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2 --no-tags\n\nAm I reading the documentation correctly ?\n\ntag <tag> syntax [1]:\n\"tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; \nit requests fetching everything up to the given tag.\"\n\n--no-tags [2] :\n\"By default, tags that point at objects that are downloaded\nfrom the remote repository are fetched and stored locally.\nThis option disables this automatic tag following.\" \n\nClearly the commits at the tips of the multiple iterations of all series ever submitted using\nGitgitgadget should not be downloaded when I'm just fetching a version of \nmy own submission, so I don't understand why these objects are fetched\nand why those local tags are created...\n\n[1] https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt-ltrefspecgt\n[2] https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---no-tags\n\nCheers,\n\nPhilippe."},{"id":"401575","messageId":"20200715072726.GA3249056@coredump.intra.peff.net","threadId":"53860","inReplyTo":"12F0A2A4-CC71-4452-B8B8-F540339F8519@gmail.com","subject":"Re: [BUG?] Fetching a single tag to a local tag requires `--no-tags`","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-07-15T07:27:26Z","receivedAt":"2020-07-15T07:27:29Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 14, 2020 at 10:17:59PM -0400, Philippe Blain wrote:\n\n> If I want to fetch a single tag from a remote repository to a local tag,\n> it seems I have to use `--no-tags`, or else all tags on the remote are fetched:\n> \n> git remote add ggg https://github.com/gitgitgadget/git\n> # this command fetches all tags on Gitgitgadget\n> git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2\n> # this command fetches only the tag listed on the command line\n> git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2 --no-tags\n\nHmm, that's not what I see:\n\n  $ git clone -q https://github.com/git/git tmp\n  $ cd tmp\n  $ git remote add ggg https://github.com/gitgitgadget/git\n  $ git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2\n  remote: Enumerating objects: 11, done.\n  remote: Counting objects: 100% (11/11), done.\n  remote: Total 18 (delta 10), reused 10 (delta 10), pack-reused 7\n  Receiving objects: 100% (18/18), 7.16 KiB | 1.79 MiB/s, done.\n  Resolving deltas: 100% (12/12), completed with 3 local objects.\n  From https://github.com/gitgitgadget/git\n   * [new tag]               pr-590/phil-blain/doc-log-multiple-ranges-v2 -> pr-590/phil-blain/doc-log-multiple-ranges-v2\n\n> Am I reading the documentation correctly ?\n> \n> tag <tag> syntax [1]:\n> \"tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; \n> it requests fetching everything up to the given tag.\"\n> \n> --no-tags [2] :\n> \"By default, tags that point at objects that are downloaded\n> from the remote repository are fetched and stored locally.\n> This option disables this automatic tag following.\" \n\nI think this last one may be an oversimplification. I'm pretty sure that\nwe'd download a tag that points to any object we already have, even if\nit wasn't just fetched.\n\n  [after this, we'll have the object still, but not the tag]\n  $ git tag -d pr-590/phil-blain/doc-log-multiple-ranges-v2\n  Deleted tag 'pr-590/phil-blain/doc-log-multiple-ranges-v2' (was 3221c3f76f)\n\n  $ git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v1\n  remote: Enumerating objects: 16, done.\n  remote: Counting objects: 100% (16/16), done.\n  remote: Total 25 (delta 15), reused 15 (delta 15), pack-reused 9\n  Receiving objects: 100% (25/25), 8.67 KiB | 2.89 MiB/s, done.\n  Resolving deltas: 100% (17/17), completed with 8 local objects.\n  From https://github.com/gitgitgadget/git\n   * [new tag]               pr-590/phil-blain/doc-log-multiple-ranges-v1 -> pr-590/phil-blain/doc-log-multiple-ranges-v1\n   * [new tag]               pr-590/phil-blain/doc-log-multiple-ranges-v2 -> pr-590/phil-blain/doc-log-multiple-ranges-v2\n\nSo in the second fetch, we got v1 and v2, because we already had the\nhistory for v2 sitting around. In the example at the beginning of my\nemail, our git.git clone was pristine. But presumably you ran into this\nin a repository where you'd been doing work on that or other ggg-tracked\ntopics.\n\n-Peff\n"},{"id":"401585","messageId":"7FB8592A-61FA-450C-B689-9E2DF879A292@gmail.com","threadId":"53860","inReplyTo":"20200715072726.GA3249056@coredump.intra.peff.net","subject":"Re: [BUG?] Fetching a single tag to a local tag requires `--no-tags`","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2020-07-15T13:05:37Z","receivedAt":"2020-07-15T13:05:43Z","isPatch":false,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Peff,\n\n> Le 15 juil. 2020 à 03:27, Jeff King <peff@peff.net> a écrit :\n> \n> On Tue, Jul 14, 2020 at 10:17:59PM -0400, Philippe Blain wrote:\n> \n>> If I want to fetch a single tag from a remote repository to a local tag,\n>> it seems I have to use `--no-tags`, or else all tags on the remote are fetched:\n>> \n>> git remote add ggg https://github.com/gitgitgadget/git\n>> # this command fetches all tags on Gitgitgadget\n>> git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2\n>> # this command fetches only the tag listed on the command line\n>> git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2 --no-tags\n> \n> Hmm, that's not what I see:\n> \n>  $ git clone -q https://github.com/git/git tmp\n>  $ cd tmp\n>  $ git remote add ggg https://github.com/gitgitgadget/git\n>  $ git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v2\n>  remote: Enumerating objects: 11, done.\n>  remote: Counting objects: 100% (11/11), done.\n>  remote: Total 18 (delta 10), reused 10 (delta 10), pack-reused 7\n>  Receiving objects: 100% (18/18), 7.16 KiB | 1.79 MiB/s, done.\n>  Resolving deltas: 100% (12/12), completed with 3 local objects.\n>  From https://github.com/gitgitgadget/git\n>   * [new tag]               pr-590/phil-blain/doc-log-multiple-ranges-v2 -> pr-590/phil-blain/doc-log-multiple-ranges-v2\n\nOups, I should have tried in a fresh clone...\n\n> \n>> Am I reading the documentation correctly ?\n>> \n>> tag <tag> syntax [1]:\n>> \"tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; \n>> it requests fetching everything up to the given tag.\"\n>> \n>> --no-tags [2] :\n>> \"By default, tags that point at objects that are downloaded\n>> from the remote repository are fetched and stored locally.\n>> This option disables this automatic tag following.\" \n> \n> I think this last one may be an oversimplification. I'm pretty sure that\n> we'd download a tag that points to any object we already have, even if\n> it wasn't just fetched.\n> \n>  [after this, we'll have the object still, but not the tag]\n>  $ git tag -d pr-590/phil-blain/doc-log-multiple-ranges-v2\n>  Deleted tag 'pr-590/phil-blain/doc-log-multiple-ranges-v2' (was 3221c3f76f)\n> \n>  $ git fetch ggg tag pr-590/phil-blain/doc-log-multiple-ranges-v1\n>  remote: Enumerating objects: 16, done.\n>  remote: Counting objects: 100% (16/16), done.\n>  remote: Total 25 (delta 15), reused 15 (delta 15), pack-reused 9\n>  Receiving objects: 100% (25/25), 8.67 KiB | 2.89 MiB/s, done.\n>  Resolving deltas: 100% (17/17), completed with 8 local objects.\n>  From https://github.com/gitgitgadget/git\n>   * [new tag]               pr-590/phil-blain/doc-log-multiple-ranges-v1 -> pr-590/phil-blain/doc-log-multiple-ranges-v1\n>   * [new tag]               pr-590/phil-blain/doc-log-multiple-ranges-v2 -> pr-590/phil-blain/doc-log-multiple-ranges-v2\n> \n> So in the second fetch, we got v1 and v2, because we already had the\n> history for v2 sitting around. In the example at the beginning of my\n> email, our git.git clone was pristine. But presumably you ran into this\n> in a repository where you'd been doing work on that or other ggg-tracked\n> topics.\n\nYes I think that what happened is I first tried \ngit fetch --tags pr-590/phil-blain/doc-log-multiple-ranges-v1,\nwhich fetched all tags, then I deleted the tags but the object stayed,\nas above, so my next fetch re-created all the tags.\n\nAnyway, sorry for the noise and thanks for you answer!\n\nPhilippe."}]}