mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-06 13:00:59 -04:00
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:
co-authored by
Claude Opus 5.5
parent
88c339a907
commit
1c79c830f8
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user