From 1c79c830f800cb5346a5eb2692302c945caacd4c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 13 Oct 2026 10:07:57 +0200 Subject: [PATCH] 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) --- pkg/commands/git_commands/worktree_loader.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/commands/git_commands/worktree_loader.go b/pkg/commands/git_commands/worktree_loader.go index ed5dc2f46..4760841c7 100644 --- a/pkg/commands/git_commands/worktree_loader.go +++ b/pkg/commands/git_commands/worktree_loader.go @@ -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) {