{"thread":{"id":"53379","subject":"--no-tags doesn't appear to be working as intended","startedAt":"2020-05-02T21:06:05Z","lastAt":"2020-05-03T18:27:40Z","messageCount":3,"participants":["Ben Denhartog","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"396848","messageId":"7480e635-97cc-4acd-875e-54bc71a88068@www.fastmail.com","threadId":"53379","inReplyTo":null,"subject":"--no-tags doesn't appear to be working as intended","fromName":"Ben Denhartog","fromEmail":"ben@sudoforge.com","sentAt":"2020-05-02T21:01:35Z","receivedAt":"2020-05-02T21:06:05Z","isPatch":false,"sender":{"key":"ben@sudoforge.com","avatar":null},"body":"From the documentation, it would appear that `--no-tags` should avoid pulling tags, even if they point to refs which match the refspec being fetched:\n\n>        -n, --no-tags\n>            By default, tags that point at objects that are downloaded from the remote repository are fetched and\n>            stored locally. This option disables this automatic tag following. The default behavior for a remote may\n>            be specified with the remote.<name>.tagOpt setting. See git-config(1). \n\nThis, however, does not appear to be the case: Either using the `--no-tags` flag on the command line directly or setting `remote.<name>.tagopt = --no-tags` appears to be ignored when running `git-fetch`. This can be recreated simply:\n\n```\n# /tmp/a will be our \"origin\"\n# /tmp/b will be our \"fork\"\nmkdir /tmp/{a,b}\n\n# set up the origin\ngit -C /tmp/a init\necho \"Hello, world\" >/tmp/a/README\ngit -C /tmp/a add README\ngit -C /tmp/a commit -m 'initial commit'\ngit -C /tmp/a tag 0.0.1 HEAD\n\n# set up the fork\ngit -C /tmp/b init\ngit -C /tmp/b remote add -f --no-tags upstream file:///tmp/a\n```\n\nYou'll see the 0.0.1 tag being fetched. You can delete it all you want, set the `remote.upstream.tagopt = --no-tags`, etc -- it will always be pulled. This is the opposite behavior I would expect based on the available documentation and discussion around the tag in the mailing list.\n\n-- \n  Ben Denhartog\n  ben@sudoforge.com\n"},{"id":"396857","messageId":"20200503065446.GA1829906@coredump.intra.peff.net","threadId":"53379","inReplyTo":"7480e635-97cc-4acd-875e-54bc71a88068@www.fastmail.com","subject":"Re: --no-tags doesn't appear to be working as intended","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-05-03T06:54:46Z","receivedAt":"2020-05-03T06:54:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, May 02, 2020 at 02:01:35PM -0700, Ben Denhartog wrote:\n\n> # set up the fork\n> git -C /tmp/b init\n> git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a\n> ```\n> \n> You'll see the 0.0.1 tag being fetched. You can delete it all you\n> want, set the `remote.upstream.tagopt = --no-tags`, etc -- it will\n> always be pulled. This is the opposite behavior I would expect based\n> on the available documentation and discussion around the tag in the\n> mailing list.\n\nI don't see that behavior. I get:\n\n  $ git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a\n  Updating upstream\n  remote: Enumerating objects: 3, done.\n  remote: Counting objects: 100% (3/3), done.\n  remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0\n  Unpacking objects: 100% (3/3), 197 bytes | 197.00 KiB/s, done.\n  From file:///tmp/a\n   * [new branch]      master     -> upstream/master\n\nIs it possible you have some other config that might be conflicting\n(e.g., extra refspecs that ask to transfer tags)? What does \"git config\n--list --show-origin\" say?\n\n-Peff\n"},{"id":"396878","messageId":"7ecc6a46-001a-45b5-8b63-7e07f88acfb9@www.fastmail.com","threadId":"53379","inReplyTo":"20200503065446.GA1829906@coredump.intra.peff.net","subject":"Re: --no-tags doesn't appear to be working as intended","fromName":"Ben Denhartog","fromEmail":"ben@sudoforge.com","sentAt":"2020-05-03T18:27:10Z","receivedAt":"2020-05-03T18:27:40Z","isPatch":false,"sender":{"key":"ben@sudoforge.com","avatar":null},"body":"Gah, sorry for the erroneous bug report, this was user error.\n\nThis was caused by having `fetch.prunetags = true` in my user-scoped conffile. As per the documentation from `git-fetch`:\n\n```\nThe --prune-tags option is equivalent to having refs/tags/*:refs/tags/* declared in the refspecs of the remote. This can lead to some seemingly strange interactions:\n\n           # These both fetch tags\n           $ git fetch --no-tags origin 'refs/tags/*:refs/tags/*'\n           $ git fetch --no-tags --prune-tags origin\n\n       The reason it doesn’t error out when provided without --prune or its config versions is for flexibility of the configured versions, and to maintain a 1=1 mapping between what the command line flags\n       do, and what the configuration versions do.\n```\n\n-- \n  Ben Denhartog\n  ben@sudoforge.com\n\nOn Sat, May 2, 2020, at 23:54, Jeff King wrote:\n> On Sat, May 02, 2020 at 02:01:35PM -0700, Ben Denhartog wrote:\n> \n> > # set up the fork\n> > git -C /tmp/b init\n> > git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a\n> > ```\n> > \n> > You'll see the 0.0.1 tag being fetched. You can delete it all you\n> > want, set the `remote.upstream.tagopt = --no-tags`, etc -- it will\n> > always be pulled. This is the opposite behavior I would expect based\n> > on the available documentation and discussion around the tag in the\n> > mailing list.\n> \n> I don't see that behavior. I get:\n> \n>   $ git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a\n>   Updating upstream\n>   remote: Enumerating objects: 3, done.\n>   remote: Counting objects: 100% (3/3), done.\n>   remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0\n>   Unpacking objects: 100% (3/3), 197 bytes | 197.00 KiB/s, done.\n>   From file:///tmp/a\n>    * [new branch]      master     -> upstream/master\n> \n> Is it possible you have some other config that might be conflicting\n> (e.g., extra refspecs that ask to transfer tags)? What does \"git config\n> --list --show-origin\" say?\n> \n> -Peff\n>\n"}]}