mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-07 22:02:56 +03:00
Cleanup
The waiting status shouldn't happen until after the user has responded to the popup. Since we're not giving a standalone prompt about clearing the patch, all of the business in `discard` doesn't need to be in a function any more
This commit is contained in:
@@ -186,15 +186,13 @@ func (self *CommitFilesController) discard(selectedNodes []*filetree.CommitFileN
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
removeFileRange := func() error {
|
|
||||||
return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(gocui.Task) error {
|
|
||||||
selectedNodes = normalisedSelectedCommitFileNodes(selectedNodes)
|
|
||||||
|
|
||||||
return self.c.Confirm(types.ConfirmOpts{
|
return self.c.Confirm(types.ConfirmOpts{
|
||||||
Title: self.c.Tr.DiscardFileChangesTitle,
|
Title: self.c.Tr.DiscardFileChangesTitle,
|
||||||
Prompt: self.c.Tr.DiscardFileChangesPrompt,
|
Prompt: self.c.Tr.DiscardFileChangesPrompt,
|
||||||
HandleConfirm: func() error {
|
HandleConfirm: func() error {
|
||||||
|
return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(gocui.Task) error {
|
||||||
var filePaths []string
|
var filePaths []string
|
||||||
|
selectedNodes = normalisedSelectedCommitFileNodes(selectedNodes)
|
||||||
|
|
||||||
// Reset the current patch if there is one.
|
// Reset the current patch if there is one.
|
||||||
if self.c.Git().Patch.PatchBuilder.Active() {
|
if self.c.Git().Patch.PatchBuilder.Active() {
|
||||||
@@ -220,12 +218,9 @@ func (self *CommitFilesController) discard(selectedNodes []*filetree.CommitFileN
|
|||||||
}
|
}
|
||||||
|
|
||||||
return self.c.Refresh(types.RefreshOptions{Mode: types.BLOCK_UI})
|
return self.c.Refresh(types.RefreshOptions{Mode: types.BLOCK_UI})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return removeFileRange()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CommitFilesController) open(node *filetree.CommitFileNode) error {
|
func (self *CommitFilesController) open(node *filetree.CommitFileNode) error {
|
||||||
|
Reference in New Issue
Block a user