git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Sparse worktree always contains root files
@ 2024-03-13 18:16 Jeppe Øland
  2024-03-13 18:34 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Jeppe Øland @ 2024-03-13 18:16 UTC (permalink / raw
  To: git

Hi there,

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.

This also happens with traditional (non-worktree) partial clones.
(I did both shallow, blob-less and tree-less, and all of them behave
the same way)

Regards,
-Jeppe


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Sparse worktree always contains root files
  2024-03-13 18:16 Sparse worktree always contains root files Jeppe Øland
@ 2024-03-13 18:34 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2024-03-13 18:34 UTC (permalink / raw
  To: Jeppe Øland; +Cc: git

Jeppe Øland <joland@gmail.com> writes:

> 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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-13 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13 18:16 Sparse worktree always contains root files Jeppe Øland
2024-03-13 18:34 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).