mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Allow passing refresh scope to WithGpgHandling
This commit is contained in:
parent
c06d4e7b18
commit
c765da10f5
5 changed files with 10 additions and 10 deletions
|
@ -20,5 +20,5 @@ func NewAmendHelper(
|
|||
func (self *AmendHelper) AmendHead() error {
|
||||
cmdObj := self.c.Git().Commit.AmendHeadCmdObj()
|
||||
self.c.LogAction(self.c.Tr.Actions.AmendCommit)
|
||||
return self.gpg.WithGpgHandling(cmdObj, git_commands.CommitGpgSign, self.c.Tr.AmendingStatus, nil)
|
||||
return self.gpg.WithGpgHandling(cmdObj, git_commands.CommitGpgSign, self.c.Tr.AmendingStatus, nil, nil)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ func NewGpgHelper(c *HelperCommon) *GpgHelper {
|
|||
// WithWaitingStatus we get stuck there and can't return to lazygit. We could
|
||||
// fix this bug, or just stop running subprocesses from within there, given that
|
||||
// we don't need to see a loading status if we're in a subprocess.
|
||||
func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, configKey git_commands.GpgConfigKey, waitingStatus string, onSuccess func() error) error {
|
||||
func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, configKey git_commands.GpgConfigKey, waitingStatus string, onSuccess func() error, refreshScope []types.RefreshableView) error {
|
||||
useSubprocess := self.c.Git().Config.NeedsGpgSubprocess(configKey)
|
||||
if useSubprocess {
|
||||
success, err := self.c.RunSubprocess(cmdObj)
|
||||
|
@ -32,20 +32,20 @@ func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, configKey git_
|
|||
return err
|
||||
}
|
||||
}
|
||||
if err := self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}); err != nil {
|
||||
if err := self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: refreshScope}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
} else {
|
||||
return self.runAndStream(cmdObj, waitingStatus, onSuccess)
|
||||
return self.runAndStream(cmdObj, waitingStatus, onSuccess, refreshScope)
|
||||
}
|
||||
}
|
||||
|
||||
func (self *GpgHelper) runAndStream(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error {
|
||||
func (self *GpgHelper) runAndStream(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error, refreshScope []types.RefreshableView) error {
|
||||
return self.c.WithWaitingStatus(waitingStatus, func(gocui.Task) error {
|
||||
if err := cmdObj.StreamOutput().Run(); err != nil {
|
||||
_ = self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
_ = self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: refreshScope})
|
||||
return fmt.Errorf(
|
||||
self.c.Tr.GitCommandFailed, self.c.UserConfig().Keybinding.Universal.ExtrasMenu,
|
||||
)
|
||||
|
@ -57,6 +57,6 @@ func (self *GpgHelper) runAndStream(cmdObj oscommands.ICmdObj, waitingStatus str
|
|||
}
|
||||
}
|
||||
|
||||
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: refreshScope})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ func (self *TagsHelper) OpenCreateTagPrompt(ref string, onCreate func()) error {
|
|||
return self.gpg.WithGpgHandling(command, git_commands.TagGpgSign, self.c.Tr.CreatingTag, func() error {
|
||||
self.commitsHelper.OnCommitSuccess()
|
||||
return nil
|
||||
})
|
||||
}, []types.RefreshableView{types.COMMITS, types.TAGS})
|
||||
}
|
||||
|
||||
onConfirm := func(tagName string, description string) error {
|
||||
|
|
|
@ -116,7 +116,7 @@ func (self *WorkingTreeHelper) handleCommit(summary string, description string,
|
|||
func() error {
|
||||
self.commitsHelper.OnCommitSuccess()
|
||||
return nil
|
||||
})
|
||||
}, nil)
|
||||
}
|
||||
|
||||
func (self *WorkingTreeHelper) switchFromCommitMessagePanelToEditor(filepath string, forceSkipHooks bool) error {
|
||||
|
|
|
@ -414,7 +414,7 @@ func (self *LocalCommitsController) handleReword(summary string, description str
|
|||
// we've selected the top commit so no rebase is required
|
||||
return self.c.Helpers().GPG.WithGpgHandling(self.c.Git().Commit.RewordLastCommit(summary, description),
|
||||
git_commands.CommitGpgSign,
|
||||
self.c.Tr.RewordingStatus, nil)
|
||||
self.c.Tr.RewordingStatus, nil, nil)
|
||||
}
|
||||
|
||||
return self.c.WithWaitingStatus(self.c.Tr.RewordingStatus, func(gocui.Task) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue