fix(worktree): disable sparse checkout on main repo after worktree creation (GH#886)

Git 2.38+ enables core.sparseCheckout on the main repo as a side effect
of worktree creation, causing confusing git status message:
"You are in a sparse checkout with 100% of tracked files present."

The fix explicitly disables sparse checkout on the main repo after
creating the beads worktree. This doesn't affect the worktree's sparse
checkout functionality since the patterns are already applied during
checkout.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/grip
2026-01-04 11:24:12 -08:00
committed by Steve Yegge
parent b3d64d47b3
commit df66ecfe9e
2 changed files with 60 additions and 0 deletions

View File

@@ -94,6 +94,13 @@ func (wm *WorktreeManager) CreateBeadsWorktree(branch, worktreePath string) erro
return fmt.Errorf("failed to checkout branch in worktree: %w\nOutput: %s", err, string(output))
}
// GH#886: Git 2.38+ enables sparse checkout on the main repo as a side effect
// of worktree creation. Explicitly disable it to prevent confusing git status
// message: "You are in a sparse checkout with 100% of tracked files present."
disableSparseCmd := exec.Command("git", "config", "core.sparseCheckout", "false")
disableSparseCmd.Dir = wm.repoPath
_ = disableSparseCmd.Run() // Best effort - don't fail if this doesn't work
return nil
}