Skip to content

Clean sparse checkout directory paths#2180

Open
ibobgunardi wants to merge 1 commit into
go-git:mainfrom
ibobgunardi:bobi/sparse-checkout-clean-paths
Open

Clean sparse checkout directory paths#2180
ibobgunardi wants to merge 1 commit into
go-git:mainfrom
ibobgunardi:bobi/sparse-checkout-clean-paths

Conversation

@ibobgunardi

Copy link
Copy Markdown

Fixes #1506.

Sparse checkout directories are repository-relative paths. ./go should resolve the same way as go, but the reset path used the raw strings for tree validation and index skip-worktree matching.

This cleans the sparse directory list once in Reset and reuses it for validation, keep-reset conflict checks, and index updates.

Tested with:

  • go test . -run "TestWorktreeSuite/TestCheckoutSparseRelativeDirs" -count=1 -v
  • go test . -run "TestWorktreeSuite/Test(CheckoutSparse|CheckoutSparseRelativeDirs|CheckoutForceSparseUntrackedPreserved|ResetSparsely|ResetSparselyInvalidDir|StatusAfterSparseCheckout)$" -count=1 -v
  • go test . -run "TestWorktreeSuite/TestCheckout" -count=1

@ibobgunardi ibobgunardi force-pushed the bobi/sparse-checkout-clean-paths branch from 313d7d4 to 492cf20 Compare June 5, 2026 17:01
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.

SparseCheckoutDirectories ignores relative paths beginning with (./) while checking out git repository

1 participant