Sparse Checkout
This PR aims to implement basic sparse checkout functionality into LibGit2 building on @jochenhz's original PR.
What does it do?
- Status / Diff takes GIT_INDEX_ENTRY_SKIP_WORKTREE into account
-
sparse-checkoutfile is treated as anattr_file, hence followinggitignorerules - Skips sparse files on checkout
- Sparse checkout can be enabled with
core.sparseCheckout - support
init,set,add,reapplyanddisablecommands all supported - Expose an interface function
git_sparse_check_pathto query whether or not a file is excluded from checkout - Set
GIT_INDEX_ENTRY_SKIP_WORKTREEflag ongit_index_read_treebased on the sparse checkout ruleset.
What does it not do?
- Smart trickery to determine whether or not a full tree is sparse (would be a very welcome optimization)
- Support
core.sparseCheckoutCone - No sparse checkout option on clone (but this can be achieved with
GIT_CHECKOUT_NONEandgit_index_read_tree)
Note
- I've got some tests around worktrees, they seem to work
- Given how complex sparse checkout can be, I'm almost certain I haven't gotten this implementation 100% correct, though feel free to prove me wrong 👍
Bump. Is there anything I can do to help progress this further?
@YuKitsune Is this PR in a state that it's working for you? I would like to patch it into a project that I'm working on and wondering if there are any rough edges I should know about.
Thanks for your work in continuing on this!
@VinnyOG We haven't gotten around to making use of this. Our use-case requires a new build of LibGit2Sharp, which proved to be too much of a pain.
I wish this would be getting attention
I've mucked up the rebase and the PR auto-closed... 🤦 Doesn't seem to let me re-open it, so I've created a new one over here https://github.com/libgit2/libgit2/pull/6394 Sorry for the mess 😅