fix(polecat): ignore .beads/ files when detecting uncommitted work
Add CleanExcludingBeads() method that returns true if the only uncommitted changes are .beads/ database files. These files are synced across worktrees and shouldn't block polecat cleanup. Fixes #516 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
f89ac47ff9
commit
c7e1451ce6
@@ -973,6 +973,37 @@ func (s *UncommittedWorkStatus) Clean() bool {
|
|||||||
return !s.HasUncommittedChanges && s.StashCount == 0 && s.UnpushedCommits == 0
|
return !s.HasUncommittedChanges && s.StashCount == 0 && s.UnpushedCommits == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CleanExcludingBeads returns true if the only uncommitted changes are .beads/ files.
|
||||||
|
// This is useful for polecat stale detection where beads database files are synced
|
||||||
|
// across worktrees and shouldn't block cleanup.
|
||||||
|
func (s *UncommittedWorkStatus) CleanExcludingBeads() bool {
|
||||||
|
// Stashes and unpushed commits always count as uncommitted work
|
||||||
|
if s.StashCount > 0 || s.UnpushedCommits > 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if all modified files are beads files
|
||||||
|
for _, f := range s.ModifiedFiles {
|
||||||
|
if !isBeadsPath(f) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if all untracked files are beads files
|
||||||
|
for _, f := range s.UntrackedFiles {
|
||||||
|
if !isBeadsPath(f) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// isBeadsPath returns true if the path is a .beads/ file.
|
||||||
|
func isBeadsPath(path string) bool {
|
||||||
|
return strings.Contains(path, ".beads/") || strings.Contains(path, ".beads\\")
|
||||||
|
}
|
||||||
|
|
||||||
// String returns a human-readable summary of uncommitted work.
|
// String returns a human-readable summary of uncommitted work.
|
||||||
func (s *UncommittedWorkStatus) String() string {
|
func (s *UncommittedWorkStatus) String() string {
|
||||||
var issues []string
|
var issues []string
|
||||||
|
|||||||
@@ -1021,9 +1021,9 @@ func (m *Manager) DetectStalePolecats(threshold int) ([]*StalenessInfo, error) {
|
|||||||
polecatGit := git.NewGit(p.ClonePath)
|
polecatGit := git.NewGit(p.ClonePath)
|
||||||
info.CommitsBehind = countCommitsBehind(polecatGit, defaultBranch)
|
info.CommitsBehind = countCommitsBehind(polecatGit, defaultBranch)
|
||||||
|
|
||||||
// Check for uncommitted work
|
// Check for uncommitted work (excluding .beads/ files which are synced across worktrees)
|
||||||
status, err := polecatGit.CheckUncommittedWork()
|
status, err := polecatGit.CheckUncommittedWork()
|
||||||
if err == nil && !status.Clean() {
|
if err == nil && !status.CleanExcludingBeads() {
|
||||||
info.HasUncommittedWork = true
|
info.HasUncommittedWork = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user