git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Is it possible to git clone --filter= without any objects?

From
Ciro Santilli <ciro.santilli@gmail.com>
Date
Sep 11, 2018, 18:29 UTC
Message-ID
<CAFXrp_emK=k7by5pM5=GpsixJVeeJhT89-Cgq3JYbn5yg14CpQ@mail.gmail.com>
In-Reply-To
<xmqqo9d4orji.fsf@gitster-ct.c.googlers.com>
On Tue, Sep 11, 2018 at 6:47 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
>
> Jonathan Tan <jonathantanmy@google.com> writes:
>
> > By "without any objects" in your email subject, do you mean "without
> > blob and tree objects"? If yes, there is some code in the
> > md/filter-trees branch that can do that with a "--filter=tree:0"
> > option.
>
> I too was wondering what the "without any objects" thing meant
> myself.
>

Thanks for all replies, as you correctly deduced, I meant "without fetching any objects".

The mentioned --filter=tree:0 would basically do what I want it seems, good to hear!. I wonder why not call it tree:none though to match blob:none.

Show 7 quoted lines
> What would it take on top of the following sequence to create such
> an ultra-lazy clone?
>
>         $ mkdir very-sparse && cd very-sparse
>         $ git init
>         $ git remote add origin $URL
>

Yes, this would be a good CLI API since the since the clone --no-checkout --filter --filter gets a bit long.

Or maybe:

git clone --lazy URL repo_local cd repo_local git checkout commit -- path/within/repo

Or maybe even:
git clene --lazy URL repo_local COMMITISH path/within/repo
to do both in one go.
People are also interested in commit-less directory / file "clones"
BTW: https://stackoverflow.com/questions/2466735/how-to-checkout-only-one-file-from-git-repository-sparse-checkout
Show 8 quoted lines
> At this point, the repository does not have any object, but it
> already knows whom to talk to to get the objects in the project.
> The remote must be configured so that it is willing to feed you any
> object you name, but would it be just some "git config" magic after
> the above three steps to make it as if it was prepared with "git
> clone --filter="?  If so, what does that magic look like?
>
> Thanks.
Previous: Junio C HamanoNext: Matthew DeVore
Message 5 of 6 in “Is it possible to git clone --filter= without any objects?”
  1. Ciro SantilliSep 11, 2018
  2. Stefan BellerSep 11, 2018
  3. Jonathan TanSep 11, 2018
  4. Junio C HamanoSep 11, 2018
  5. Ciro SantilliSep 11, 2018
  6. Matthew DeVoreSep 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.