diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-16 11:20:22 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-30 18:35:21 +1000 |
commit | 03f726038e05f420e7a4ff9837a9ee46635b1297 (patch) | |
tree | f125f8810fb2e2ce9f91ffd41ce18e077000da5e /pkg/gui | |
parent | 796945aad00eb894eb446c0d78c49561d43af075 (diff) |
Alert when attempting to enter the current worktree
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/controllers/worktrees_controller.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/gui/controllers/worktrees_controller.go b/pkg/gui/controllers/worktrees_controller.go index 042d96898..0c515b564 100644 --- a/pkg/gui/controllers/worktrees_controller.go +++ b/pkg/gui/controllers/worktrees_controller.go @@ -140,6 +140,10 @@ func (self *WorktreesController) GetOnClick() func() error { } func (self *WorktreesController) enter(worktree *models.Worktree) error { + if self.c.Git().Worktree.IsCurrentWorktree(worktree) { + return self.c.ErrorMsg(self.c.Tr.AlreadyInWorktree) + } + // if we were in a submodule, we want to forget about that stack of repos // so that hitting escape in the new repo does nothing self.c.State().GetRepoPathStack().Clear() |