Mark untracked directories that are git repositories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 20:12:13 +02:00
co-authored by Claude Sonnet 5.5
parent 69d0f9b704
commit af6d03a5b1
7 changed files with 45 additions and 3 deletions
+16 -1
View File
@@ -55,7 +55,7 @@ func (s *Status) Issues() []Issue {
case WorktreeModified:
out = append(out, Issue{IssueChanged, LevelWarn, "uncommitted changes"})
case WorktreeUntracked:
out = append(out, Issue{IssueChanged, LevelWarn, "untracked files"})
out = append(out, Issue{IssueChanged, LevelWarn, s.untrackedText()})
}
return out
}
@@ -79,3 +79,18 @@ func Walk(mods []*Submodule, fn func(*Submodule)) {
Walk(m.Children, fn)
}
}
// untrackedText words the untracked-files issue: "untracked repository" if
// everything untracked is a git repository of its own, e.g. a clone that was
// never added as a submodule.
func (s *Status) untrackedText() string {
if s.Changes == nil || s.Changes.Total != len(s.Changes.Files) {
return "untracked files"
}
for _, f := range s.Changes.Files {
if f.Kind != ChangeUntracked || !f.Repo {
return "untracked files"
}
}
return "untracked repository"
}