Re: Git commit causes data download in partial clone
- From
- charmocc <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 :)