Fix lint issues and sparse checkout for empty repos

- Handle empty repos in ConfigureSparseCheckout (skip read-tree when no HEAD)
- Fix errcheck: wrap fileLock.Unlock() error in defer
- Fix unparam: remove unused *rig.Rig return from getWitnessManager
- Fix unparam: mark unused agentType parameter with blank identifier

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
julianknutsen
2026-01-06 02:16:15 -08:00
parent be815db5e4
commit 09bbb0f430
4 changed files with 19 additions and 11 deletions

View File

@@ -644,6 +644,14 @@ func ConfigureSparseCheckout(repoPath string) error {
return fmt.Errorf("writing sparse-checkout: %w", err)
}
// Check if HEAD exists (repo has commits) before running read-tree
// Empty repos (no commits) don't need read-tree and it would fail
checkHead := exec.Command("git", "-C", repoPath, "rev-parse", "--verify", "HEAD")
if err := checkHead.Run(); err != nil {
// No commits yet, sparse checkout config is set up for future use
return nil
}
// Reapply to remove excluded files
cmd = exec.Command("git", "-C", repoPath, "read-tree", "-mu", "HEAD")
stderr.Reset()