git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Jeppe Øland" <joland@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Sparse worktree always contains root files
Date: Wed, 13 Mar 2024 11:34:26 -0700	[thread overview]
Message-ID: <xmqqr0geaslp.fsf@gitster.g> (raw)
In-Reply-To: <CA+osTZWsGv01xinFPKbTQOF9mpvfwWs4wJczHSZXLdRxf1OmwA@mail.gmail.com> ("Jeppe Øland"'s message of "Wed, 13 Mar 2024 11:16:46 -0700")

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.

      reply	other threads:[~2024-03-13 18:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 18:16 Sparse worktree always contains root files Jeppe Øland
2024-03-13 18:34 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr0geaslp.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=joland@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).