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

Re: Git commit causes data download in partial clone

From
Ccharmocc <charmocc@proton.me>
Date
Feb 22, 2024, 19:34 UTC
Message-ID
<MIda3qF70GEKtbezTxMyZo7RrlyBmvzN8w1T28cnCro4dmTqwjhQjBe2A-PYbgS6jkkev3pzd4oxqmbOfucfifVhTRQsynmjCpbQmvPzm8k=@proton.me>
In-Reply-To
<20240220024310.GD2713741@coredump.intra.peff.net>
Jeff thank you for taking a look at this.

On Tuesday, February 20th, 2024 at 3:43 AM, Jeff King <peff@peff.net> wrote:

Show 6 quoted lines
> a. Your --no-checkout skips the checkout, but it does not tell Git
> that you are fundamentally uninterested in those other paths. To do
> that, you can try the sparse-checkout mechanism. I'm not super
> familiar with the feature myself, but doing:
> 
> git clone --sparse --filter=blob:none $url nes

That's it! Now git knows exactly what I want from it. I am now able to add and commit new files and git status no longer lists any deleted paths. Also I can search for files I actually need with "git ls-files" and add them to the sparse checkout incrementally with "git sparse-checkout add". I haven't explored this feature before because because I assumed it is limited to selecting entire directory subtrees not individual files which would not help with the mentioned repo.

Show 6 quoted lines
> Do note that --sparse checks out the contents of the top-level tree
> by default. That's OK for your repo (all of the files are in the
> Named_Titles directory), but it might not be true for some other
> repos (it may also not work if your intent is to put another entry
> into Named_Titles, though it looks like you might just need to say
> "git add --sparse").

I think this could be avoided by cloning with --no-checkout, creating index with "git reset" and setting up empty sparse checkout afterwards with "git sparse-checkout set /".

Anyway it seems like with these tools I'm finally ready to tackle any huge git repo they throw at me in the future :)

Previous: Jeff King
Message 3 of 3 in “Git commit causes data download in partial clone”
  1. charmoccFeb 17, 2024
  2. Jeff KingFeb 20, 2024
  3. charmoccFeb 22, 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.