libgit2 icon indicating copy to clipboard operation
libgit2 copied to clipboard

Sparse Checkout

Open YuKitsune opened this issue 4 years ago • 2 comments

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-checkout file is treated as an attr_file, hence following gitignore rules
  • Skips sparse files on checkout
  • Sparse checkout can be enabled with core.sparseCheckout
  • support init, set, add, reapply and disable commands all supported
  • Expose an interface function git_sparse_check_path to query whether or not a file is excluded from checkout
  • Set GIT_INDEX_ENTRY_SKIP_WORKTREE flag on git_index_read_tree based 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_NONE and git_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 👍

YuKitsune avatar Jan 12 '22 01:01 YuKitsune

Bump. Is there anything I can do to help progress this further?

YuKitsune avatar Jun 21 '22 05:06 YuKitsune

@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 avatar Aug 05 '22 18:08 VinnyOG

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

YuKitsune avatar Aug 10 '22 23:08 YuKitsune

I wish this would be getting attention

extrawurst avatar Aug 17 '22 12:08 extrawurst

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 😅

YuKitsune avatar Aug 30 '22 23:08 YuKitsune