{"thread":{"id":"51313","subject":"advertised commit fetch using commit id fails","startedAt":"2019-06-14T11:02:14Z","lastAt":"2019-06-14T15:29:15Z","messageCount":3,"participants":["Karen Arutyunov","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"377231","messageId":"38030a81-73bc-f877-362a-3fd8018b5977@codesynthesis.com","threadId":"51313","inReplyTo":null,"subject":"advertised commit fetch using commit id fails","fromName":"Karen Arutyunov","fromEmail":"karen@codesynthesis.com","sentAt":"2019-06-14T10:54:15Z","receivedAt":"2019-06-14T11:02:14Z","isPatch":false,"sender":{"key":"karen@codesynthesis.com","avatar":null},"body":"Hello,\n\ngit 2.22, in contrast to previous versions, fails to fetch advertised \ncommit using commit id:\n\n$ git --version\ngit version 2.22.0\n\n$ git init git\n$ git -C git remote add origin https://github.com/git/git\n\n$ git ls-remote https://github.com/git/git | grep v2.21\n2bb64867dc05d9a8432488ddc1d22a194cee4d31\trefs/tags/v2.21.0\n8104ec994ea3849a968b4667d072fedd1e688642\trefs/tags/v2.21.0^{}\ne4be0477c7bd475c863a361d7d8aeaeab621606c\trefs/tags/v2.21.0-rc0\nd62dad7a7dca3f6a65162bf0e52cdf6927958e78\trefs/tags/v2.21.0-rc0^{}\n8b301c10ed2bc973cec4f8395dec90fce2df42fb\trefs/tags/v2.21.0-rc1\n8989e1950a845ceeb186d490321a4f917ca4de47\trefs/tags/v2.21.0-rc1^{}\n1c668b7b88be5f46f8dc8fe403842cdc663185d9\trefs/tags/v2.21.0-rc2\n35ee755a8c43bcb3c2786522d423f006c23d32df\trefs/tags/v2.21.0-rc2^{}\n\n$ git -C git fetch origin 8104ec994ea3849a968b4667d072fedd1e688642\nerror: Server does not allow request for unadvertised object \n8104ec994ea3849a968b4667d072fedd1e688642\n\n\nFetching using tag id still works:\n\n$ git -C git fetch origin 2bb64867dc05d9a8432488ddc1d22a194cee4d31\nremote: Enumerating objects: 255575, done.\nremote: Total 255575 (delta 0), reused 0 (delta 0), pack-reused 255575\nReceiving objects: 100% (255575/255575), 107.95 MiB | 2.34 MiB/s, done.\nResolving deltas: 100% (190845/190845), done.\n From https://github.com/git/git\n  * branch            2bb64867dc05d9a8432488ddc1d22a194cee4d31 -> FETCH_HEAD\n\n\nFetching using commit id that is a tip of some branch works also:\n\n$ git ls-remote https://github.com/git/git | grep \nb697d92f56511e804b8ba20ccbe7bdc85dc66810\nb697d92f56511e804b8ba20ccbe7bdc85dc66810\trefs/heads/maint\nb697d92f56511e804b8ba20ccbe7bdc85dc66810\trefs/tags/v2.22.0^{}\n\n$ git -C git fetch origin b697d92f56511e804b8ba20ccbe7bdc85dc66810\nremote: Enumerating objects: 260471, done.\nremote: Total 260471 (delta 0), reused 0 (delta 0), pack-reused 260471\nReceiving objects: 100% (260471/260471), 112.66 MiB | 2.33 MiB/s, done.\nResolving deltas: 100% (194715/194715), done.\n From https://github.com/git/git\n  * branch            b697d92f56511e804b8ba20ccbe7bdc85dc66810 -> FETCH_HEAD\n\n\nNote that the git version at the tip of the master branch \n(2.22.0.68.g0aae918dd9) behaves the same way.\n\n\ngit 2.21 fetches fine:\n\n$ git --version\ngit version 2.21.0\n\n$ git -C git fetch origin 8104ec994ea3849a968b4667d072fedd1e688642\nremote: Enumerating objects: 255574, done.\nremote: Total 255574 (delta 0), reused 0 (delta 0), pack-reused 255574\nReceiving objects: 100% (255574/255574), 107.95 MiB | 2.15 MiB/s, done.\nResolving deltas: 100% (190845/190845), done.\n From https://github.com/git/git\n  * branch            8104ec994ea3849a968b4667d072fedd1e688642 -> FETCH_HEAD\n\n\nIs it a bug or advertised object semantics change?\n\nBest regards,\nKaren\n"},{"id":"377237","messageId":"20190614152710.GB22984@sigill.intra.peff.net","threadId":"51313","inReplyTo":"38030a81-73bc-f877-362a-3fd8018b5977@codesynthesis.com","subject":"Re: advertised commit fetch using commit id fails","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-06-14T15:27:10Z","receivedAt":"2019-06-14T15:27:13Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 14, 2019 at 01:54:15PM +0300, Karen Arutyunov wrote:\n\n> git 2.22, in contrast to previous versions, fails to fetch advertised commit\n> using commit id:\n>\n> Is it a bug or advertised object semantics change?\n\nThis is working as designed, but the behavior is a rather tricky\nhistorical case. The change you're seeing is due to 34066f0661 (fetch:\ndo not consider peeled tags as advertised tips, 2019-04-13), and there's\nfurther discussion in the thread at:\n\n  https://public-inbox.org/git/20180610143231.7131-1-kirr@nexedi.com/\n\nBasically, upload-pack has never considered the peeled value of a tag to\nbe \"advertised\" for the purposes of letting the client request it. But\nby default, in git-over-http mode, the server does act as if\nuploadpack.allowReachableSHA1InWant is set, which comes from 051e4005a3\n(helping smart-http/stateless-rpc fetch race, 2011-08-05).\n\nSo even though the server does not advertise that it will accept non-tip\nsha1s, it happened to do so only over this one protocol. If you retry\nyour fetch over git:// or ssh, it would fail with any version.\n\nIt would also fail even with http for versions prior to v2.14, because\nthe bug to consider peeled tips as advertised on the client side comes\nfrom fdb69d33c4 (fetch-pack: always allow fetching of literal SHA1s,\n2017-05-15).\n\nSo in short, it was never supposed to work, but between bugs and\nprotocol vagaries, there are a few version and protocol combinations\nwhere it did.\n\n-Peff\n"},{"id":"377238","messageId":"20190614152911.GC22984@sigill.intra.peff.net","threadId":"51313","inReplyTo":"20190614152710.GB22984@sigill.intra.peff.net","subject":"Re: advertised commit fetch using commit id fails","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-06-14T15:29:12Z","receivedAt":"2019-06-14T15:29:15Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 14, 2019 at 11:27:10AM -0400, Jeff King wrote:\n\n> So in short, it was never supposed to work, but between bugs and\n> protocol vagaries, there are a few version and protocol combinations\n> where it did.\n\nI'd add that in protocol v2, the reachability restrictions are lifted\n(i.e., every server behaves as if uploadpack.allowAnySHA1InWant is\nenabled). So you could probably just set protocol.version=2 on your\nclient. This will eventually becomes the default, too.\n\n-Peff\n"}]}