{"thread":{"id":"51340","subject":"Updating local tags: bugs and general feasibility","startedAt":"2019-06-19T13:25:24Z","lastAt":"2019-06-19T13:25:24Z","messageCount":1,"participants":["Karen Arutyunov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"377518","messageId":"981804d3-1485-f100-7b0e-8f1bc58226a5@codesynthesis.com","threadId":"51340","inReplyTo":null,"subject":"Updating local tags: bugs and general feasibility","fromName":"Karen Arutyunov","fromEmail":"karen@codesynthesis.com","sentAt":"2019-06-19T13:25:17Z","receivedAt":"2019-06-19T13:25:24Z","isPatch":false,"sender":{"key":"karen@codesynthesis.com","avatar":null},"body":"Hello,\n\nI'm trying to configure my git client to update local tags with the \nremote ones. Prior to git 2.20 the following option in ~/.gitconfig did \nthe job:\n\n[remote \"origin\"]\n\ttagopt = --tags\n\nSo the following commands worked as expected and the local tag gets updated:\n\n# Create remote repository.\n#\n$ git init foo.git\n$ touch foo.git/README\n$ git -C foo.git/ add README\n$ git -C foo.git/ commit -m \"Release 1.0.0\"\n$ git -C foo.git/ tag -a -m \"Tag version 1.0.0\" \"v1.0.0\"\n\n# Create local repository.\n#\n$ git clone foo.git\n\n# Update remote repository moving the tag.\n#\n$ echo \"TODO\" >foo.git/README\n$ git -C foo.git/ commit -a -m \"Revision 1.0.0+1\"\n$ git -C foo.git/ tag -a -f -m \"Tag version 1.0.0+1\" \"v1.0.0\"\nUpdated tag 'v1.0.0' (was 3b773b1)\n\n# Update local repository moving the tag.\n#\n$ git -C foo pull\n...\nt [tag update]      v1.0.0     -> v1.0.0\n...\n\nStaring with git 2.20 the last command expectedly (according to the \ngit-fetch documentation) fails:\n\n$ git -C foo pull\n...\n  ! [rejected]        v1.0.0     -> v1.0.0  (would clobber existing tag)\n\nReplacing the tagopt option in ~/.gitconfig with the following helps and \nthe above git-pull command succeeds:\n\n[remote \"origin\"]\n\tfetch = +refs/tags/*:refs/tags/*\n\n(This approach is recommended by several stackoverflow answers and\n  studying git documentation gives the impression that it is the proper\n  way to accomplish this.)\n\nHowever, starting with git 2.21 in the presence of this configuration \noption I'm no longer able to clone any repository that contains tags:\n\n$ git clone foo.git\nCloning into 'foo'...\ndone.\nfatal: multiple updates for ref 'refs/tags/v1.0.0' not allowed\nfatal: the remote end hung up unexpectedly\n\nBut still can succeed by running:\n\n$ git init foo\n$ git -C foo remote add origin ../foo.git\n$ git -C foo fetch\n...\n >From ../foo\n  * [new tag]         v1.0.0     -> v1.0.0\n  * [new branch]      master     -> origin/master\n$ git -C foo checkout master\n\nNote that the git version at the tip of the master branch (a6a95cd) \nbehaves the same way.\n\nIs it a bug or am I somehow misusing this fetch configuration option?\n\nYet another strange thing I've noticed (that also happens for git \nversions prior to 2.20) is that removing a remote tag also removes the \nlocal tag in the presence of this fetch configuration option:\n\n$ git -C foo tag\nv1.0.0\n$ git -C foo push origin :v1.0.0\n$ git -C foo tag\n\nIs it a bug or does the fetch option somehow also affects the push \noperation?\n\nThe more general question: is overwriting tags, while generally not \nrecommended, nevertheless a valid approach for some sensible use cases \n(e.g., a tag that always refers to the latest stable version or some \nsuch) or is this not going to be supported long term and we are on our \nown trying to accomplish this?\n\nIf the approach is considered to be valid, are there any plans to allow \nconfiguring a remote git repository in a way that when it is \npulled/fetched, the local tags get updated without any additional \nconfiguration effort from the user?\n\nThanks,\nKaren\n"}]}