1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-03 13:21:56 +02:00

Show loader when switching worktrees

This commit is contained in:
Jesse Duffield 2023-07-17 19:31:26 +10:00
parent 81a9133261
commit b5ff55e538
2 changed files with 32 additions and 27 deletions

View File

@ -8,6 +8,7 @@ import (
"sync" "sync"
"github.com/jesseduffield/generics/slices" "github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/gocui"
appTypes "github.com/jesseduffield/lazygit/pkg/app/types" appTypes "github.com/jesseduffield/lazygit/pkg/app/types"
"github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
@ -143,6 +144,7 @@ func (self *ReposHelper) DispatchSwitchToRepo(path string, reuse bool, contextKe
} }
func (self *ReposHelper) DispatchSwitchTo(path string, reuse bool, errMsg string, contextKey types.ContextKey) error { func (self *ReposHelper) DispatchSwitchTo(path string, reuse bool, errMsg string, contextKey types.ContextKey) error {
return self.c.WithWaitingStatus(self.c.Tr.Switching, func(gocui.Task) error {
env.UnsetGitDirEnvs() env.UnsetGitDirEnvs()
originalPath, err := os.Getwd() originalPath, err := os.Getwd()
if err != nil { if err != nil {
@ -179,4 +181,5 @@ func (self *ReposHelper) DispatchSwitchTo(path string, reuse bool, errMsg string
defer self.c.Mutexes().RefreshingFilesMutex.Unlock() defer self.c.Mutexes().RefreshingFilesMutex.Unlock()
return self.onNewRepo(appTypes.StartArgs{}, reuse, contextKey) return self.onNewRepo(appTypes.StartArgs{}, reuse, contextKey)
})
} }

View File

@ -544,6 +544,7 @@ type TranslationSet struct {
ExitSearchMode string ExitSearchMode string
ExitTextFilterMode string ExitTextFilterMode string
SwitchToWorktree string SwitchToWorktree string
Switching string
RemoveWorktree string RemoveWorktree string
RemoveWorktreeTitle string RemoveWorktreeTitle string
DetachWorktree string DetachWorktree string
@ -1278,6 +1279,7 @@ func EnglishTranslationSet() TranslationSet {
WorktreesTitle: "Worktrees", WorktreesTitle: "Worktrees",
WorktreeTitle: "Worktree", WorktreeTitle: "Worktree",
SwitchToWorktree: "Switch to worktree", SwitchToWorktree: "Switch to worktree",
Switching: "Switching",
RemoveWorktree: "Remove worktree", RemoveWorktree: "Remove worktree",
RemoveWorktreeTitle: "Remove worktree", RemoveWorktreeTitle: "Remove worktree",
RemoveWorktreePrompt: "Are you sure you want to remove worktree '{{.worktreeName}}'?", RemoveWorktreePrompt: "Are you sure you want to remove worktree '{{.worktreeName}}'?",