Cleanup: make WorktreeLoader.pathExists return what its name says

It returns true if the path is missing. It started out as
IsWorktreePathMissing, and was renamed without inverting its result
when it moved into the loader in de57cfd6ff.

Invert the result instead of renaming it back, so that the call site
reads `IsPathMissing: !self.pathExists(path)`. If we can't check the
path, it still counts as existing, as it always did.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-10-15 08:35:00 +02:00
co-authored by Claude Opus 5.5
parent 88c339a907
commit 1c79c830f8
+5 -4
View File
@@ -53,7 +53,7 @@ func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error) {
path := strings.SplitN(splitLine, " ", 2)[1]
current = &models.Worktree{
IsPathMissing: self.pathExists(path),
IsPathMissing: !self.pathExists(path),
Path: path,
// we defer populating GitDir until a loop below so that
// we can parallelize the calls to git rev-parse, and
@@ -158,12 +158,13 @@ func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error) {
func (self *WorktreeLoader) pathExists(path string) bool {
if _, err := self.Fs.Stat(path); err != nil {
if errors.Is(err, iofs.ErrNotExist) {
return true
return false
}
// We can't tell, so we don't show the worktree as missing
self.Log.Errorf("failed to check if worktree path `%s` exists\n%v", path, err)
return false
return true
}
return false
return true
}
func (self *WorktreeLoader) rebasedBranch(worktree *models.Worktree) (string, bool) {