Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse Checkout #6394

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open

Conversation

YuKitsune
Copy link

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 YuKitsune mentioned this pull request Aug 30, 2022
@YuKitsune YuKitsune marked this pull request as ready for review August 30, 2022 23:09
jochenhz and others added 27 commits January 25, 2023 14:22
…ile diffing

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
…used by sparse checkout code as well

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
The sparse-checkout file is treated as a git_attr_file. A public API git_sparse_check_path reads the sparse-checkout file from the attribute file cache and checks the path against this attribute file using the gitignore ruleset

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
…ed git_sparse object

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
…es that are excluded by the sparse checkout ruleset - if sparse checkout is enabled

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
…arse

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
…accessed by checkout and diff functionalities quickly.

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
…heckout

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
…ries

Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
Signed-off-by: Jochen Hunz <j.hunz@anchorpoint.app>
- Temporarily remove cone references, will need to revisit
- Updating references in tests
VinnyOG pushed a commit to 8thwall/libgit2 that referenced this pull request Jan 31, 2023
VinnyOG pushed a commit to 8thwall/libgit2 that referenced this pull request Mar 8, 2023
@wtfacoconut
Copy link

wtfacoconut commented Sep 14, 2023

This PR seems really promising with lots of people wanting sparse-checkout support. Not just directly from the libgit2 community (#2263), but also from all of the other projects that are built with libgit2. Are there any particular blockers for merging this? The last update seems to be from 8 months ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants