summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-16 11:20:22 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-30 18:35:21 +1000
commit03f726038e05f420e7a4ff9837a9ee46635b1297 (patch)
treef125f8810fb2e2ce9f91ffd41ce18e077000da5e /pkg/gui
parent796945aad00eb894eb446c0d78c49561d43af075 (diff)
Alert when attempting to enter the current worktree
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/controllers/worktrees_controller.go4
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()