mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Allow passing refresh scope to WithGpgHandling
This commit is contained in:
@ -20,5 +20,5 @@ func NewAmendHelper(
|
|||||||
func (self *AmendHelper) AmendHead() error {
|
func (self *AmendHelper) AmendHead() error {
|
||||||
cmdObj := self.c.Git().Commit.AmendHeadCmdObj()
|
cmdObj := self.c.Git().Commit.AmendHeadCmdObj()
|
||||||
self.c.LogAction(self.c.Tr.Actions.AmendCommit)
|
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
|
// 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
|
// 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.
|
// 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)
|
useSubprocess := self.c.Git().Config.NeedsGpgSubprocess(configKey)
|
||||||
if useSubprocess {
|
if useSubprocess {
|
||||||
success, err := self.c.RunSubprocess(cmdObj)
|
success, err := self.c.RunSubprocess(cmdObj)
|
||||||
@ -32,20 +32,20 @@ func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, configKey git_
|
|||||||
return err
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
} else {
|
} 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 {
|
return self.c.WithWaitingStatus(waitingStatus, func(gocui.Task) error {
|
||||||
if err := cmdObj.StreamOutput().Run(); err != nil {
|
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(
|
return fmt.Errorf(
|
||||||
self.c.Tr.GitCommandFailed, self.c.UserConfig().Keybinding.Universal.ExtrasMenu,
|
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 {
|
return self.gpg.WithGpgHandling(command, git_commands.TagGpgSign, self.c.Tr.CreatingTag, func() error {
|
||||||
self.commitsHelper.OnCommitSuccess()
|
self.commitsHelper.OnCommitSuccess()
|
||||||
return nil
|
return nil
|
||||||
})
|
}, []types.RefreshableView{types.COMMITS, types.TAGS})
|
||||||
}
|
}
|
||||||
|
|
||||||
onConfirm := func(tagName string, description string) error {
|
onConfirm := func(tagName string, description string) error {
|
||||||
|
@ -116,7 +116,7 @@ func (self *WorkingTreeHelper) handleCommit(summary string, description string,
|
|||||||
func() error {
|
func() error {
|
||||||
self.commitsHelper.OnCommitSuccess()
|
self.commitsHelper.OnCommitSuccess()
|
||||||
return nil
|
return nil
|
||||||
})
|
}, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *WorkingTreeHelper) switchFromCommitMessagePanelToEditor(filepath string, forceSkipHooks bool) error {
|
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
|
// we've selected the top commit so no rebase is required
|
||||||
return self.c.Helpers().GPG.WithGpgHandling(self.c.Git().Commit.RewordLastCommit(summary, description),
|
return self.c.Helpers().GPG.WithGpgHandling(self.c.Git().Commit.RewordLastCommit(summary, description),
|
||||||
git_commands.CommitGpgSign,
|
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 {
|
return self.c.WithWaitingStatus(self.c.Tr.RewordingStatus, func(gocui.Task) error {
|
||||||
|
Reference in New Issue
Block a user