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

Use git lingo

This commit is contained in:
Jesse Duffield
2023-07-16 13:53:59 +10:00
parent c713d550c0
commit fe8adf9eb8
3 changed files with 47 additions and 37 deletions

View File

@ -7,6 +7,7 @@ import (
"log"
"os"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@ -62,11 +63,13 @@ func (self *WorktreeHelper) NewWorktree() error {
return self.c.Prompt(types.PromptOpts{
Title: self.c.Tr.NewWorktreePath,
HandleConfirm: func(committish string) error {
self.c.LogAction(self.c.Tr.Actions.CreateWorktree)
if err := self.c.Git().Worktree.New(sanitizedBranchName(path), committish); err != nil {
return err
}
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
return self.c.WithWaitingStatus(self.c.Tr.AddingWorktree, func(gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.AddWorktree)
if err := self.c.Git().Worktree.New(sanitizedBranchName(path), committish); err != nil {
return err
}
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
})
},
})
},