1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Style missing worktree as red and display better error when trying to switch to them

Use a broken link icon for missing worktrees
This commit is contained in:
Joel Baranick
2022-09-02 09:35:08 -07:00
committed by Jesse Duffield
parent 9a79154d05
commit c679fd1924
10 changed files with 103 additions and 85 deletions

View File

@ -138,6 +138,10 @@ func (self *ReposHelper) CreateRecentReposMenu() error {
}
func (self *ReposHelper) DispatchSwitchToRepo(path string, reuse bool) error {
return self.DispatchSwitchTo(path, reuse, self.c.Tr.ErrRepositoryMovedOrDeleted)
}
func (self *ReposHelper) DispatchSwitchTo(path string, reuse bool, errMsg string) error {
env.UnsetGitDirEnvs()
originalPath, err := os.Getwd()
if err != nil {
@ -146,7 +150,7 @@ func (self *ReposHelper) DispatchSwitchToRepo(path string, reuse bool) error {
if err := os.Chdir(path); err != nil {
if os.IsNotExist(err) {
return self.c.ErrorMsg(self.c.Tr.ErrRepositoryMovedOrDeleted)
return self.c.ErrorMsg(errMsg)
}
return err
}