You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sparse badge sticks after git sparse-checkout disable (detection reads only pattern-file presence) #9921
A worktree that was sparse-checked-out and later fully restored with git sparse-checkout disable keeps showing the sparse badge and the tooltip "Partial checkout. Files outside these paths are not on disk." — even though every file is on disk and core.sparseCheckout=false.
Root cause
detectSparseCheckout (src/main/git/worktree.ts) infers sparsity purely from the existence + non-zero size of <gitdir>/info/sparse-checkout:
The comment states the assumption: "Git writes this file when sparse checkout is enabled … and does not write it otherwise." That assumption is wrong. git sparse-checkout disable sets core.sparseCheckout=false and repopulates the working tree, but deliberately leaves info/sparse-checkout in place so the checkout can be re-enabled with the same patterns. The fast-path probe from #1290 therefore reports a false positive.
Reproduce
git init repo &&cd repo
mkdir keep drop && touch keep/f drop/f && git add -A && git commit -m init
git sparse-checkout set keep # core.sparseCheckout=true -> Orca: sparse (correct)
git sparse-checkout disable # core.sparseCheckout=false, full tree restored
ls .git/info/sparse-checkout # still present -> Orca: still "sparse" (WRONG)
Ground truth after disable: core.sparseCheckout=false, full working tree, 0 skip-worktree entries — yet the badge and "files are not on disk" tooltip persist.
Fix
Keep the cheap fs.stat as a fast-path gate, but when the pattern file is present, confirm core.sparseCheckout is actually enabled by reading git's config files directly (shared repo config and, under extensions.worktreeConfig, the per-worktree config.worktree, honoring precedence). No subprocess, and it only runs for the rare worktree that still has a non-empty pattern file — so it does not reintroduce the per-poll git sparse-checkout list fan-out #1290 removed.
PR: tao-io/orca fix/sparse-checkout-false-positive-after-disable (adds a real-git regression test + config-parser unit tests).
Related (separate, not in this PR)
For SSH / disconnected worktrees, isSparse is synthesized purely from persisted WorktreeMeta (sparseDirectories/sparseBaseRef/sparsePresetId). The sparsePresetId doc comment says these are "Cleared when the worktree is no longer sparse on refresh", but no reconciliation code clears them — so a stale badge can persist there independently of git state. Worth a follow-up.
Activity
nwparker commentedon Jul 24, 2026
Fixed by #9922 — sparse detection now checks
core.sparseCheckout, so a disabled sparse checkout no longer keeps the badge.Feel free to reopen if you still see it after updating.