{"thread":{"id":"49314","subject":"Is it possible to git clone --filter= without any objects?","startedAt":"2018-09-11T07:29:20Z","lastAt":"2018-09-12T01:12:17Z","messageCount":6,"participants":["Ciro Santilli","Stefan Beller","Jonathan Tan","Junio C Hamano","Matthew DeVore"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"357854","messageId":"CAFXrp_fLwL5=K3B5rWjY+imoqtskT8LG-UH8ec3CPwM0iiSzFg@mail.gmail.com","threadId":"49314","inReplyTo":null,"subject":"Is it possible to git clone --filter= without any objects?","fromName":"Ciro Santilli","fromEmail":"ciro.santilli@gmail.com","sentAt":"2018-09-11T07:29:06Z","receivedAt":"2018-09-11T07:29:20Z","isPatch":false,"sender":{"key":"ciro.santilli@gmail.com","avatar":"https://gravatar.com/avatar/24a59ac21bfa4133ba88106940ec03cc546a14b2afd61ff6b810b06b9732a772?d=mp&s=160"},"body":"At v2.19.0 I was trying to clone a fetch just a single directory:\nhttps://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934\n\nI got really close with:\n\ngit clone --depth 1 --no-checkout --filter=blob:none \\\n  \"file://$(pwd)/server_repo\" local_repo\ncd local_repo\ngit checkout master -- mydir/\n\nThe only missing thing is that uneeded tree objects are still being fetched.\n\nIf I had a:\n\ngit clone --filter=none\n\nfor example then that would be done.\n\nNothing major since those are small, but just looking for the perfect\ncommand :-)\n"},{"id":"357878","messageId":"CAGZ79kYK7ish4_DaZN2bCfZz7LNAjxogQH1k6T=hFcxxkXzJQw@mail.gmail.com","threadId":"49314","inReplyTo":"CAFXrp_fLwL5=K3B5rWjY+imoqtskT8LG-UH8ec3CPwM0iiSzFg@mail.gmail.com","subject":"Re: Is it possible to git clone --filter= without any objects?","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-09-11T17:15:29Z","receivedAt":"2018-09-11T17:15:44Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Sep 11, 2018 at 12:29 AM Ciro Santilli <ciro.santilli@gmail.com> wrote:\n>\n> At v2.19.0 I was trying to clone a fetch just a single directory:\n> https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934\n>\n> I got really close with:\n>\n> git clone --depth 1 --no-checkout --filter=blob:none \\\n>   \"file://$(pwd)/server_repo\" local_repo\n> cd local_repo\n> git checkout master -- mydir/\n>\n> The only missing thing is that uneeded tree objects are still being fetched.\n>\n> If I had a:\n>\n> git clone --filter=none\n>\n> for example then that would be done.\n>\n> Nothing major since those are small, but just looking for the perfect\n> command :-)\n\nYou might be pleased to hear about a series floating on the mailing list,\nthat started at\nhttps://public-inbox.org/git/cover.1533854545.git.matvore@google.com/\nand promised to filter trees away, and its latest version can be found at\nhttps://public-inbox.org/git/cover.1536081438.git.matvore@google.com/\n\nThanks,\nStefan\n"},{"id":"357879","messageId":"CAGf8dgKLz14ijnXwV0Y=M48Rij-scA19E_uXk3pBc0T02oE_0Q@mail.gmail.com","threadId":"49314","inReplyTo":"CAGZ79kYK7ish4_DaZN2bCfZz7LNAjxogQH1k6T=hFcxxkXzJQw@mail.gmail.com","subject":"Re: Is it possible to git clone --filter= without any objects?","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2018-09-11T17:19:03Z","receivedAt":"2018-09-11T17:19:07Z","isPatch":false,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"On Tue, Sep 11, 2018 at 10:15 AM, Stefan Beller <sbeller@google.com> wrote:\n> You might be pleased to hear about a series floating on the mailing list,\n> that started at\n> https://public-inbox.org/git/cover.1533854545.git.matvore@google.com/\n> and promised to filter trees away, and its latest version can be found at\n> https://public-inbox.org/git/cover.1536081438.git.matvore@google.com/\n\nI mentioned this in an email to the original poster in which I forgot\nto also CC the mailing list:\n\nBy \"without any objects\" in your email subject, do you mean \"without\nblob and tree objects\"? If yes, there is some code in the\nmd/filter-trees branch that can do that with a \"--filter=tree:0\"\noption. As far as I know, it is not yet in any released version of\nGit, but hopefully will be in the next one (the \"What's Cooking\" [1]\nemail mentions that it will be merged to the \"next\" branch, which is\none of the steps before it is released).\n\n[1] https://public-inbox.org/git/xmqqmusw6gbo.fsf@gitster-ct.c.googlers.com/\n"},{"id":"357883","messageId":"xmqqo9d4orji.fsf@gitster-ct.c.googlers.com","threadId":"49314","inReplyTo":"CAGf8dgKLz14ijnXwV0Y=M48Rij-scA19E_uXk3pBc0T02oE_0Q@mail.gmail.com","subject":"Re: Is it possible to git clone --filter= without any objects?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-09-11T17:46:57Z","receivedAt":"2018-09-11T17:47:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Tan <jonathantanmy@google.com> writes:\n\n> By \"without any objects\" in your email subject, do you mean \"without\n> blob and tree objects\"? If yes, there is some code in the\n> md/filter-trees branch that can do that with a \"--filter=tree:0\"\n> option.\n\nI too was wondering what the \"without any objects\" thing meant\nmyself.\n\nWhat would it take on top of the following sequence to create such\nan ultra-lazy clone?\n\n\t$ mkdir very-sparse && cd very-sparse\n\t$ git init\n\t$ git remote add origin $URL\n\nAt this point, the repository does not have any object, but it\nalready knows whom to talk to to get the objects in the project.\nThe remote must be configured so that it is willing to feed you any\nobject you name, but would it be just some \"git config\" magic after\nthe above three steps to make it as if it was prepared with \"git\nclone --filter=\"?  If so, what does that magic look like?\n\nThanks.\n"},{"id":"357888","messageId":"CAFXrp_emK=k7by5pM5=GpsixJVeeJhT89-Cgq3JYbn5yg14CpQ@mail.gmail.com","threadId":"49314","inReplyTo":"xmqqo9d4orji.fsf@gitster-ct.c.googlers.com","subject":"Re: Is it possible to git clone --filter= without any objects?","fromName":"Ciro Santilli","fromEmail":"ciro.santilli@gmail.com","sentAt":"2018-09-11T18:29:18Z","receivedAt":"2018-09-11T18:30:00Z","isPatch":false,"sender":{"key":"ciro.santilli@gmail.com","avatar":"https://gravatar.com/avatar/24a59ac21bfa4133ba88106940ec03cc546a14b2afd61ff6b810b06b9732a772?d=mp&s=160"},"body":"On Tue, Sep 11, 2018 at 6:47 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Jonathan Tan <jonathantanmy@google.com> writes:\n>\n> > By \"without any objects\" in your email subject, do you mean \"without\n> > blob and tree objects\"? If yes, there is some code in the\n> > md/filter-trees branch that can do that with a \"--filter=tree:0\"\n> > option.\n>\n> I too was wondering what the \"without any objects\" thing meant\n> myself.\n>\n\nThanks for all replies, as you correctly deduced, I meant \"without\nfetching any objects\".\n\nThe mentioned --filter=tree:0 would basically do what I want it seems,\ngood to hear!. I wonder why not call it tree:none though to match\nblob:none.\n\n> What would it take on top of the following sequence to create such\n> an ultra-lazy clone?\n>\n>         $ mkdir very-sparse && cd very-sparse\n>         $ git init\n>         $ git remote add origin $URL\n>\n\nYes, this would be a good CLI API since the since the clone\n--no-checkout --filter --filter gets a bit long.\n\nOr maybe:\n\ngit clone --lazy URL repo_local\ncd repo_local\ngit checkout commit -- path/within/repo\n\nOr maybe even:\n\ngit clene --lazy URL repo_local COMMITISH path/within/repo\n\nto do both in one go.\n\nPeople are also interested in commit-less directory / file \"clones\"\nBTW: https://stackoverflow.com/questions/2466735/how-to-checkout-only-one-file-from-git-repository-sparse-checkout\n\n> At this point, the repository does not have any object, but it\n> already knows whom to talk to to get the objects in the project.\n> The remote must be configured so that it is willing to feed you any\n> object you name, but would it be just some \"git config\" magic after\n> the above three steps to make it as if it was prepared with \"git\n> clone --filter=\"?  If so, what does that magic look like?\n>\n> Thanks.\n"},{"id":"357939","messageId":"CAMfpvhKYN3E+AJdwFM3k9e4awg5sW8dnVnmROA4W10mQMxWB9A@mail.gmail.com","threadId":"49314","inReplyTo":"CAFXrp_emK=k7by5pM5=GpsixJVeeJhT89-Cgq3JYbn5yg14CpQ@mail.gmail.com","subject":"Re: Is it possible to git clone --filter= without any objects?","fromName":"Matthew DeVore","fromEmail":"matvore@google.com","sentAt":"2018-09-12T01:12:02Z","receivedAt":"2018-09-12T01:12:17Z","isPatch":false,"sender":{"key":"matvore@google.com","avatar":"https://avatars.githubusercontent.com/u/946637?v=4"},"body":"On Tue, Sep 11, 2018 at 11:30 AM Ciro Santilli <ciro.santilli@gmail.com> wrote:\n> The mentioned --filter=tree:0 would basically do what I want it seems,\n> good to hear!. I wonder why not call it tree:none though to match\n> blob:none.\nThere are some plans of making tree: accept positive integers in order\nto filter out files greater than that depth. e.g. tree:1 would fetch\nall blobs and tree objects directly contained by the tree. tree:2\nwould fetch every object tree:1 does plus anything referred to\ndirectly by those objects.\n"}]}