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

Re: Sparse worktree always contains root files

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 13, 2024, 18:34 UTC
Message-ID
<xmqqr0geaslp.fsf@gitster.g>
In-Reply-To
<CA+osTZWsGv01xinFPKbTQOF9mpvfwWs4wJczHSZXLdRxf1OmwA@mail.gmail.com>
Jeppe Øland <joland@gmail.com> writes:
Show 10 quoted lines
> I'm trying to use sparse checkouts in a large project, and one oddity
> (bug?) came up.
>
> If I do a normal full clone of a repository, then do:
>     git worktree add ../sparse --no-checkout
>     cd ../sparse
>     git sparse-checkout set somepath
>     git checkout
> Now indeed it is a sparse worktree, but the files from the root
> directory are also there.
I think this is working as intended.

Without knowing about the non-tree entries' object names, you cannot create your next commit on top, as you need to be able to compute the tree object's contents. You'd update some files in "somepath", and that directory being populated you can compute the object name of the tree that represents the state of "somepath" after your update. But that object name must be mixed with other things in the same directory as "somepath" (i.e. in the root tree), so they must be known.

Previous: Jeppe Øland
Message 2 of 2 in “Sparse worktree always contains root files”
  1. Jeppe ØlandMar 13, 2024
  2. Junio C HamanoMar 13, 2024

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.