{"thread":{"id":"57429","subject":"Supporting --depth when cloning from a bundle","startedAt":"2022-02-16T22:07:18Z","lastAt":"2022-02-17T21:06:11Z","messageCount":4,"participants":["Konstantin Ryabitsev","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"448642","messageId":"20220216220710.td4vp6mile5m6hjn@meerkat.local","threadId":"57429","inReplyTo":null,"subject":"Supporting --depth when cloning from a bundle","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2022-02-16T22:07:10Z","receivedAt":"2022-02-16T22:07:18Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"Hello, all:\n\nIt would be pretty handy if it was possible to do shallow clones from a bundle\nfile. For example, this would be nice for CI environments that first download\na clone.bundle file from a locally cached location, clone from it, and then\nfetch any remaining objects from remote.\n\nE.g., in my mind this outta work:\n\n$ wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/clone.bundle\n$ git clone --depth 1 clone.bundle linux -b master\n\nRight now, this operation succeeds as-is without any errors, but the resulting\ngit repository isn't actually shallow.\n\nOh, it would be even awesomer if the bundle files could be used directly with\n--reference, e.g.:\n\n$ git clone --reference clone.bundle --dissociate \\\n  https://git.kernel.org/.../torvalds/linux.git linux\n\nAny reason that can't work?\n\n-K\n"},{"id":"448644","messageId":"xmqqzgmqbfq7.fsf@gitster.g","threadId":"57429","inReplyTo":"20220216220710.td4vp6mile5m6hjn@meerkat.local","subject":"Re: Supporting --depth when cloning from a bundle","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-02-16T22:37:20Z","receivedAt":"2022-02-16T22:37:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:\n\n> Hello, all:\n>\n> It would be pretty handy if it was possible to do shallow clones from a bundle\n> file. For example, this would be nice for CI environments that first download\n> a clone.bundle file from a locally cached location, clone from it, and then\n> fetch any remaining objects from remote.\n>\n> E.g., in my mind this outta work:\n>\n> $ wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/clone.bundle\n> $ git clone --depth 1 clone.bundle linux -b master\n>\n> Right now, this operation succeeds as-is without any errors, but the resulting\n> git repository isn't actually shallow.\n>\n> Oh, it would be even awesomer if the bundle files could be used directly with\n> --reference, e.g.:\n>\n> $ git clone --reference clone.bundle --dissociate \\\n>   https://git.kernel.org/.../torvalds/linux.git linux\n>\n> Any reason that can't work?\n\nThe \"depth\" is used to negitiate what objects to include in the\npackfile that is transmit from the other side.  That would not\nfundamentally work on bundles, because a bundle is pregenerated and\nthere is nobody on the other side for you to negotiate with to\naffect what objects are included in the packfile which is contained\nin the bundle file.\n\nYou _should_ be able to make the resulting full clone into a shallow\none, though.\n"},{"id":"448705","messageId":"20220217141910.oaa6i4lvnotrbecq@meerkat.local","threadId":"57429","inReplyTo":"xmqqzgmqbfq7.fsf@gitster.g","subject":"Re: Supporting --depth when cloning from a bundle","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2022-02-17T14:19:10Z","receivedAt":"2022-02-17T14:19:17Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"On Wed, Feb 16, 2022 at 02:37:20PM -0800, Junio C Hamano wrote:\n> The \"depth\" is used to negitiate what objects to include in the\n> packfile that is transmit from the other side.  That would not\n> fundamentally work on bundles, because a bundle is pregenerated and\n> there is nobody on the other side for you to negotiate with to\n> affect what objects are included in the packfile which is contained\n> in the bundle file.\n\nJunio:\n\nSorry for the potentially stupid follow-up question. I know that git makes a\ndistinction when cloning locally between a direct path and a file:// URL (e.g.\nit's only possible to do a shallow clone from a local repository when using\nthe file:// scheme). When that happens, doesn't that same negotiation happen\nlocally (perhaps in a simulated way)? If that so, then theoretically the same\napproach could be taken with the bundle file?\n\n(I'm not actually that interested in that feature, to be honest -- I'd much\nrather see further work on git-native CDN offload of packfiles, so we stop\nusing kludges like bundle files for this purpose.)\n\n-K\n"},{"id":"448735","messageId":"xmqq7d9t8aq4.fsf@gitster.g","threadId":"57429","inReplyTo":"20220217141910.oaa6i4lvnotrbecq@meerkat.local","subject":"Re: Supporting --depth when cloning from a bundle","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-02-17T21:05:55Z","receivedAt":"2022-02-17T21:06:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:\n\n> Sorry for the potentially stupid follow-up question. I know that git makes a\n> distinction when cloning locally between a direct path and a file:// URL (e.g.\n> it's only possible to do a shallow clone from a local repository when using\n> the file:// scheme).\n\nThe local optimization uses hardlinks into an existing repository\nbypassing most of what makes Git Git, and there is no negotiation.\n\n\"clone --no-local $PATH\" or \"clone file://$PATH\" runs the \"server\nside\" inside $PATH and talks with it, which is ONLY possible because\n$PATH is a real repository.  A bundle file is not a repository, and\nnobody has written the \"server side\" to workin inside it, so...\n"}]}