{"thread":{"id":"64098","subject":"git-2.51.0: Fetching tags does not work","startedAt":"2025-09-06T00:30:52Z","lastAt":"2025-11-03T08:50:36Z","messageCount":9,"participants":["David Bohman","Junio C Hamano","rsbecker@nexbridge.com","Chris Torek","Karthik Nayak"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"525683","messageId":"CAB9xhmPcHnB2+i6WeA3doAinv7RAeGs04+n0fHLGToJq=UKUNw@mail.gmail.com","threadId":"64098","inReplyTo":null,"subject":"git-2.51.0: Fetching tags does not work","fromName":"David Bohman","fromEmail":"debohman@gmail.com","sentAt":"2025-09-06T00:30:40Z","receivedAt":"2025-09-06T00:30:52Z","isPatch":false,"sender":{"key":"debohman@gmail.com","avatar":null},"body":"This is into a bare repository:\n\ngit fetch --tags\n\nThe command notates the tags it will update, but they do not get added\nto the repository.\n\nI reverted to git-2.50.1, and the problem went away. This is a\nregression in git-2.51.0.\n\nDavid Bohman\n"},{"id":"525684","messageId":"xmqqcy8418me.fsf@gitster.g","threadId":"64098","inReplyTo":"CAB9xhmPcHnB2+i6WeA3doAinv7RAeGs04+n0fHLGToJq=UKUNw@mail.gmail.com","subject":"Re: git-2.51.0: Fetching tags does not work","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-09-06T04:56:57Z","receivedAt":"2025-09-06T04:57:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Bohman <debohman@gmail.com> writes:\n\n> This is into a bare repository:\n>\n> git fetch --tags\n>\n> The command notates the tags it will update, but they do not get added\n> to the repository.\n>\n> I reverted to git-2.50.1, and the problem went away. This is a\n> regression in git-2.51.0.\n\nThe following is my attempt to reproduce (\"rungit $version\" is my\nway to invoke any one of many versions of Git I have installed).\n\nFirst let's create a bare clone of a repository \"foo\" in bar.git\n\n: git x; rungit v2.51.0 clone --bare file://$(pwd)/foo bar.git\nCloning into bare repository 'bar.git'...\nremote: Enumerating objects: 3, done.\nremote: Counting objects: 100% (3/3), done.\nremote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)\nReceiving objects: 100% (3/3), done.\n: git x; cd bar.git\n: git bar.git/BARE:master; rungit v2.51.0 for-each-ref\ndcd3daa27e4c2f5182cfa80e5097fed4936b7037 commit refs/heads/master\n\nSo now I cloned from \"foo\" to obtain the \"master\" branch.  There is\nno tag, so nothing else was transferred.\n\nThen we go back to \"foo\", create a new commit, and a tag.\n\n: git bar.git/BARE:master; cd ../foo\n: git foo/master; date >stamp && rungit v2.51.0 commit -a -m \"second\"\nHEAD is now at 2ec78a8 second\n: git foo/master; rungit v2.51.0 tag really\n: git foo/master; rungit v2.51.0 for-each-ref\n2ec78a8e44a74213773a96f6c870b59ae2bfc7f0 commit refs/heads/master\n2ec78a8e44a74213773a96f6c870b59ae2bfc7f0 commit refs/tags/really\n\nNow we have an updated branch plus a tag.  We go back to the bare\nrepository that was created earlier by cloning \"foo\".\n\n: git foo/master; cd ../bar.git\n: git bar.git/BARE:master; rungit v2.51.0 fetch --dry-run\nremote: Enumerating objects: 5, done.\nremote: Counting objects: 100% (5/5), done.\nremote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)\nUnpacking objects: 100% (3/3), 252 bytes | 63.00 KiB/s, done.\nFrom file:///var/tmp/x/foo\n * branch            HEAD       -> FETCH_HEAD\n\nWithout --tags, we would not fetch the tag.\n\n: git bar.git/BARE:master; rungit v2.51.0 fetch --dry-run --tags\nFrom file:///var/tmp/x/foo\n * branch            HEAD       -> FETCH_HEAD\n * [new tag]         really     -> really\n\nWith --tags, we would.  After seeing these two dry-run results,\nand making sure ...\n\n: git bar.git/BARE:master; rungit v2.51.0 for-each-ref\ndcd3daa27e4c2f5182cfa80e5097fed4936b7037 commit refs/heads/master\n\n... dry-runs did not do anything, let's try a fetch for real.\n\n: git bar.git/BARE:master; rungit v2.51.0 fetch --tags\nFrom file:///var/tmp/x/foo\n * branch            HEAD       -> FETCH_HEAD\n * [new tag]         really     -> really\n: git bar.git/BARE:master; rungit v2.51.0 for-each-ref\ndcd3daa27e4c2f5182cfa80e5097fed4936b7037 commit refs/heads/master\n2ec78a8e44a74213773a96f6c870b59ae2bfc7f0 commit refs/tags/really\n\nWe have the tag fetched.  Note that this bare clone does not have\nany fetch refspec,...\n\n: git bar.git/BARE:master; cat config\n[core]\n        repositoryformatversion = 0\n        filemode = true\n        bare = true\n[remote \"origin\"]\n        url = file:///var/tmp/x/foo\n\n...so the master branch hasn't been updated (the new value is only\nin FETCH_HEAD, which is expected).\n\nAs we can see here, my local copy of 2.51 does not seem to exhibit\nsuch a problem, so you may need to narrow it down a bit more for\nothers to be able to help.\n\nThanks.\n"},{"id":"530085","messageId":"CAB9xhmPw6P1J2a3P+btUT1chhNQrhcx3pSkq+vqZbhFhCqcX9w@mail.gmail.com","threadId":"64098","inReplyTo":"xmqqcy8418me.fsf@gitster.g","subject":"Re: git-2.51.0: Fetching tags does not work","fromName":"David Bohman","fromEmail":"debohman@gmail.com","sentAt":"2025-11-03T00:47:06Z","receivedAt":"2025-11-03T00:47:19Z","isPatch":false,"sender":{"key":"debohman@gmail.com","avatar":null},"body":"I am sorry to have to bring this up again, but I am still occasionally\nseeing this problem with git 2.51.2.\n\nWhat is happening is that I am cloning a repository as bare, and then\nlater I try to fetch the new content including the tags:\n\n% ( cd bind9.git; git fetch --tags )\nFrom https://gitlab.isc.org/isc-projects/bind9\n * branch                  HEAD       -> FETCH_HEAD\n ! [rejected]              stable     -> stable  (would clobber existing tag)\n * [new tag]               v9.18.41   -> v9.18.41\n * [new tag]               v9.20.15   -> v9.20.15\n * [new tag]               v9.21.14   -> v9.21.14\n% ( cd bind9.git; git fetch --tags )\nFrom https://gitlab.isc.org/isc-projects/bind9\n * branch                  HEAD       -> FETCH_HEAD\n ! [rejected]              stable     -> stable  (would clobber existing tag)\n * [new tag]               v9.18.41   -> v9.18.41\n * [new tag]               v9.20.15   -> v9.20.15\n * [new tag]               v9.21.14   -> v9.21.14\n% print $?\n1\n% ( cd bind9.git; git tag ) | grep v9.20.15\n%\n\nAs you can see, it is getting an error for one of the tags, but it is\nalso failing to record the other new tags into the repository.\n"},{"id":"530087","messageId":"01b001dc4c62$04943500$0dbc9f00$@nexbridge.com","threadId":"64098","inReplyTo":"CAB9xhmPw6P1J2a3P+btUT1chhNQrhcx3pSkq+vqZbhFhCqcX9w@mail.gmail.com","subject":"RE: git-2.51.0: Fetching tags does not work","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2025-11-03T01:34:32Z","receivedAt":"2025-11-03T01:34:42Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On November 2, 2025 7:47 PM, David Bohman wrote:\n>I am sorry to have to bring this up again, but I am still occasionally seeing this\n>problem with git 2.51.2.\n>\n>What is happening is that I am cloning a repository as bare, and then later I try to\n>fetch the new content including the tags:\n>\n>% ( cd bind9.git; git fetch --tags )\n>>From https://gitlab.isc.org/isc-projects/bind9\n> * branch                  HEAD       -> FETCH_HEAD\n> ! [rejected]              stable     -> stable  (would clobber existing tag)\n> * [new tag]               v9.18.41   -> v9.18.41\n> * [new tag]               v9.20.15   -> v9.20.15\n> * [new tag]               v9.21.14   -> v9.21.14\n>% ( cd bind9.git; git fetch --tags )\n>>From https://gitlab.isc.org/isc-projects/bind9\n> * branch                  HEAD       -> FETCH_HEAD\n> ! [rejected]              stable     -> stable  (would clobber existing tag)\n> * [new tag]               v9.18.41   -> v9.18.41\n> * [new tag]               v9.20.15   -> v9.20.15\n> * [new tag]               v9.21.14   -> v9.21.14\n>% print $?\n>1\n>% ( cd bind9.git; git tag ) | grep v9.20.15 %\n>\n>As you can see, it is getting an error for one of the tags, but it is also failing to record\n>the other new tags into the repository.\n\ngit fetch --tags --force\n\nshould clear your situation, where the tag is different on the upstream compare to\nyour local clone.\n\n"},{"id":"530088","messageId":"CAB9xhmPAe1z8wqWnbpPuPE=y=nuKMsGG3_bk+DkGmXDfshaaiA@mail.gmail.com","threadId":"64098","inReplyTo":"CAB9xhmPw6P1J2a3P+btUT1chhNQrhcx3pSkq+vqZbhFhCqcX9w@mail.gmail.com","subject":"Re: git-2.51.0: Fetching tags does not work","fromName":"David Bohman","fromEmail":"debohman@gmail.com","sentAt":"2025-11-03T01:41:16Z","receivedAt":"2025-11-03T01:41:29Z","isPatch":false,"sender":{"key":"debohman@gmail.com","avatar":null},"body":"I am able to reproduce this locally using a bare main repository, a\nlocal bare clone of it, and a non bare clone of the main to insert\nrevisions and tags into the main. If you move an existing tag in the\nmain using push -f and then try to fetch --tags into the bare clone,\nit fails to insert a new tag into the bare clone:\n\n% ( cd test2.git; git fetch --tags )\nFrom /private/tmp/test\n * branch            HEAD       -> FETCH_HEAD\n ! [rejected]        stable     -> stable  (would clobber existing tag)\n * [new tag]         v5         -> v5\n% ( cd test2.git; git fetch --tags )\nFrom /private/tmp/test\n * branch            HEAD       -> FETCH_HEAD\n ! [rejected]        stable     -> stable  (would clobber existing tag)\n * [new tag]         v5         -> v5\n% print $?\n1\n% ( cd test2.git; git fetch --tags )\nFrom /private/tmp/test\n * branch            HEAD       -> FETCH_HEAD\n ! [rejected]        stable     -> stable  (would clobber existing tag)\n * [new tag]         v5         -> v5\n% ( cd test2.git; git tag ) | grep v5\n%\n\nOn Sun, Nov 2, 2025 at 4:47 PM David Bohman <debohman@gmail.com> wrote:\n>\n> I am sorry to have to bring this up again, but I am still occasionally\n> seeing this problem with git 2.51.2.\n>\n> What is happening is that I am cloning a repository as bare, and then\n> later I try to fetch the new content including the tags:\n>\n> % ( cd bind9.git; git fetch --tags )\n> From https://gitlab.isc.org/isc-projects/bind9\n>  * branch                  HEAD       -> FETCH_HEAD\n>  ! [rejected]              stable     -> stable  (would clobber existing tag)\n>  * [new tag]               v9.18.41   -> v9.18.41\n>  * [new tag]               v9.20.15   -> v9.20.15\n>  * [new tag]               v9.21.14   -> v9.21.14\n> % ( cd bind9.git; git fetch --tags )\n> From https://gitlab.isc.org/isc-projects/bind9\n>  * branch                  HEAD       -> FETCH_HEAD\n>  ! [rejected]              stable     -> stable  (would clobber existing tag)\n>  * [new tag]               v9.18.41   -> v9.18.41\n>  * [new tag]               v9.20.15   -> v9.20.15\n>  * [new tag]               v9.21.14   -> v9.21.14\n> % print $?\n> 1\n> % ( cd bind9.git; git tag ) | grep v9.20.15\n> %\n>\n> As you can see, it is getting an error for one of the tags, but it is\n> also failing to record the other new tags into the repository.\n"},{"id":"530089","messageId":"CAB9xhmMzqDUXk4K=p4EW+OybH68WTGBLVW+tPwjO1nTeAtiPZA@mail.gmail.com","threadId":"64098","inReplyTo":"01b001dc4c62$04943500$0dbc9f00$@nexbridge.com","subject":"Re: git-2.51.0: Fetching tags does not work","fromName":"David Bohman","fromEmail":"debohman@gmail.com","sentAt":"2025-11-03T01:45:32Z","receivedAt":"2025-11-03T01:45:44Z","isPatch":false,"sender":{"key":"debohman@gmail.com","avatar":null},"body":"On Sun, Nov 2, 2025 at 5:34 PM <rsbecker@nexbridge.com> wrote:\n>\n> On November 2, 2025 7:47 PM, David Bohman wrote:\n> >I am sorry to have to bring this up again, but I am still occasionally seeing this\n> >problem with git 2.51.2.\n> >\n> >What is happening is that I am cloning a repository as bare, and then later I try to\n> >fetch the new content including the tags:\n> >\n> >% ( cd bind9.git; git fetch --tags )\n> >>From https://gitlab.isc.org/isc-projects/bind9\n> > * branch                  HEAD       -> FETCH_HEAD\n> > ! [rejected]              stable     -> stable  (would clobber existing tag)\n> > * [new tag]               v9.18.41   -> v9.18.41\n> > * [new tag]               v9.20.15   -> v9.20.15\n> > * [new tag]               v9.21.14   -> v9.21.14\n> >% ( cd bind9.git; git fetch --tags )\n> >>From https://gitlab.isc.org/isc-projects/bind9\n> > * branch                  HEAD       -> FETCH_HEAD\n> > ! [rejected]              stable     -> stable  (would clobber existing tag)\n> > * [new tag]               v9.18.41   -> v9.18.41\n> > * [new tag]               v9.20.15   -> v9.20.15\n> > * [new tag]               v9.21.14   -> v9.21.14\n> >% print $?\n> >1\n> >% ( cd bind9.git; git tag ) | grep v9.20.15 %\n> >\n> >As you can see, it is getting an error for one of the tags, but it is also failing to record\n> >the other new tags into the repository.\n>\n> git fetch --tags --force\n>\n> should clear your situation, where the tag is different on the upstream compare to\n> your local clone.\n>\n\nOkay, but before 2.51, it would fail to move the existing tag but\nstill insert the new tags.\n"},{"id":"530090","messageId":"CAPx1GvfYyEKNepKWhjr66i0vPm4VVz=J0f=aym7P2uPKueSFhw@mail.gmail.com","threadId":"64098","inReplyTo":"CAB9xhmMzqDUXk4K=p4EW+OybH68WTGBLVW+tPwjO1nTeAtiPZA@mail.gmail.com","subject":"Re: git-2.51.0: Fetching tags does not work","fromName":"Chris Torek","fromEmail":"chris.torek@gmail.com","sentAt":"2025-11-03T01:52:57Z","receivedAt":"2025-11-03T01:53:10Z","isPatch":false,"sender":{"key":"chris.torek@gmail.com","avatar":"https://avatars.githubusercontent.com/u/16826774?v=4"},"body":"> Okay, but before 2.51, it would fail to move the existing tag but\n> still insert the new tags.\n\nThis is a change in behavior, and no doubt due to the new\nreference transaction system: now either all tags get updated,\nor none do.\n\nWhich behavior is the buggy one is the real question. :-)\n\nChris\n"},{"id":"530091","messageId":"CAB9xhmNiYv-9UezPguKzY3Q2Cq=ngeNaEi6Dr-B-Ds+s4BuEeA@mail.gmail.com","threadId":"64098","inReplyTo":"CAPx1GvfYyEKNepKWhjr66i0vPm4VVz=J0f=aym7P2uPKueSFhw@mail.gmail.com","subject":"Re: git-2.51.0: Fetching tags does not work","fromName":"David Bohman","fromEmail":"debohman@gmail.com","sentAt":"2025-11-03T02:38:08Z","receivedAt":"2025-11-03T02:38:19Z","isPatch":false,"sender":{"key":"debohman@gmail.com","avatar":null},"body":"On Sun, Nov 2, 2025 at 5:53 PM Chris Torek <chris.torek@gmail.com> wrote:\n>\n> > Okay, but before 2.51, it would fail to move the existing tag but\n> > still insert the new tags.\n>\n> This is a change in behavior, and no doubt due to the new\n> reference transaction system: now either all tags get updated,\n> or none do.\n>\n> Which behavior is the buggy one is the real question. :-)\n>\n> Chris\n\nI believe that this is a risky change for a mature tool like git. It\nhas the potential to break all sorts of stuff once it starts to be\nadopted out into the wild. Also note that the diagnostic messages are\nmisleading. It flags the moved tag as an error, but reports the new\ntags without error and then fails to insert them.\n\nDavid\n"},{"id":"530112","messageId":"CAOLa=ZT3abHfkNVzwpJyGEhvm5dijdaKSCkoEFgQuLhvab-=aQ@mail.gmail.com","threadId":"64098","inReplyTo":"CAB9xhmPAe1z8wqWnbpPuPE=y=nuKMsGG3_bk+DkGmXDfshaaiA@mail.gmail.com","subject":"Re: git-2.51.0: Fetching tags does not work","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-11-03T08:50:34Z","receivedAt":"2025-11-03T08:50:36Z","isPatch":false,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"David Bohman <debohman@gmail.com> writes:\n\n> I am able to reproduce this locally using a bare main repository, a\n> local bare clone of it, and a non bare clone of the main to insert\n> revisions and tags into the main. If you move an existing tag in the\n> main using push -f and then try to fetch --tags into the bare clone,\n> it fails to insert a new tag into the bare clone:\n>\n> % ( cd test2.git; git fetch --tags )\n> From /private/tmp/test\n>  * branch            HEAD       -> FETCH_HEAD\n>  ! [rejected]        stable     -> stable  (would clobber existing tag)\n>  * [new tag]         v5         -> v5\n> % ( cd test2.git; git fetch --tags )\n> From /private/tmp/test\n>  * branch            HEAD       -> FETCH_HEAD\n>  ! [rejected]        stable     -> stable  (would clobber existing tag)\n>  * [new tag]         v5         -> v5\n> % print $?\n> 1\n> % ( cd test2.git; git fetch --tags )\n> From /private/tmp/test\n>  * branch            HEAD       -> FETCH_HEAD\n>  ! [rejected]        stable     -> stable  (would clobber existing tag)\n>  * [new tag]         v5         -> v5\n> % ( cd test2.git; git tag ) | grep v5\n> %\n>\n\nThanks for reporting back, I missed your first email.\n\nI can confirm that I could reproduce this too. I'm currently looking\ninto this and I'm certain that this is due to the transaction reference\nupdates. Nevertheless, I am looking into it and will come back when I\nfind the cause.\n\n- Karthik\n\n> On Sun, Nov 2, 2025 at 4:47 PM David Bohman <debohman@gmail.com> wrote:\n>>\n>> I am sorry to have to bring this up again, but I am still occasionally\n>> seeing this problem with git 2.51.2.\n>>\n>> What is happening is that I am cloning a repository as bare, and then\n>> later I try to fetch the new content including the tags:\n>>\n>> % ( cd bind9.git; git fetch --tags )\n>> From https://gitlab.isc.org/isc-projects/bind9\n>>  * branch                  HEAD       -> FETCH_HEAD\n>>  ! [rejected]              stable     -> stable  (would clobber existing tag)\n>>  * [new tag]               v9.18.41   -> v9.18.41\n>>  * [new tag]               v9.20.15   -> v9.20.15\n>>  * [new tag]               v9.21.14   -> v9.21.14\n>> % ( cd bind9.git; git fetch --tags )\n>> From https://gitlab.isc.org/isc-projects/bind9\n>>  * branch                  HEAD       -> FETCH_HEAD\n>>  ! [rejected]              stable     -> stable  (would clobber existing tag)\n>>  * [new tag]               v9.18.41   -> v9.18.41\n>>  * [new tag]               v9.20.15   -> v9.20.15\n>>  * [new tag]               v9.21.14   -> v9.21.14\n>> % print $?\n>> 1\n>> % ( cd bind9.git; git tag ) | grep v9.20.15\n>> %\n>>\n>> As you can see, it is getting an error for one of the tags, but it is\n>> also failing to record the other new tags into the repository.\n"}]}