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

Improve name handling

This commit is contained in:
Jesse Duffield
2023-07-16 13:43:20 +10:00
parent d19d89ea9d
commit c713d550c0
8 changed files with 189 additions and 19 deletions

View File

@ -58,12 +58,17 @@ func (self *WorktreeHelper) IsWorktreePathMissing(w *models.Worktree) bool {
func (self *WorktreeHelper) NewWorktree() error {
return self.c.Prompt(types.PromptOpts{
Title: self.c.Tr.NewWorktreePath,
HandleConfirm: func(response string) error {
self.c.LogAction(self.c.Tr.Actions.CreateWorktree)
if err := self.c.Git().Worktree.New(sanitizedBranchName(response)); err != nil {
return err
}
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
HandleConfirm: func(path string) 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})
},
})
},
})
}