1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-31 23:19:40 +02:00

Alert when attempting to enter the current worktree

This commit is contained in:
Jesse Duffield 2023-07-16 11:20:22 +10:00
parent 796945aad0
commit 03f726038e
2 changed files with 6 additions and 0 deletions

View File

@ -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()

View File

@ -550,6 +550,7 @@ type TranslationSet struct {
DeleteWorktreePrompt string
ForceDeleteWorktreePrompt string
CantDeleteCurrentWorktree string
AlreadyInWorktree string
CantDeleteMainWorktree string
NoWorktreesThisRepo string
MissingWorktree string
@ -1268,6 +1269,7 @@ func EnglishTranslationSet() TranslationSet {
DeleteWorktreePrompt: "Are you sure you want to delete worktree '{{.worktreeName}}'?",
ForceDeleteWorktreePrompt: "'{{.worktreeName}}' is not fully merged. Are you sure you want to delete it?",
CantDeleteCurrentWorktree: "You cannot delete the current worktree!",
AlreadyInWorktree: "You are already in the selected worktree",
CantDeleteMainWorktree: "You cannot delete the main worktree!",
NoWorktreesThisRepo: "No worktrees",
MissingWorktree: "(missing)",