Skip to content

Commit c765da1

Browse files
committed
Allow passing refresh scope to WithGpgHandling
1 parent c06d4e7 commit c765da1

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

pkg/gui/controllers/helpers/amend_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ func NewAmendHelper(
2020
func (self *AmendHelper) AmendHead() error {
2121
cmdObj := self.c.Git().Commit.AmendHeadCmdObj()
2222
self.c.LogAction(self.c.Tr.Actions.AmendCommit)
23-
return self.gpg.WithGpgHandling(cmdObj, git_commands.CommitGpgSign, self.c.Tr.AmendingStatus, nil)
23+
return self.gpg.WithGpgHandling(cmdObj, git_commands.CommitGpgSign, self.c.Tr.AmendingStatus, nil, nil)
2424
}

pkg/gui/controllers/helpers/gpg_helper.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func NewGpgHelper(c *HelperCommon) *GpgHelper {
2323
// WithWaitingStatus we get stuck there and can't return to lazygit. We could
2424
// fix this bug, or just stop running subprocesses from within there, given that
2525
// we don't need to see a loading status if we're in a subprocess.
26-
func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, configKey git_commands.GpgConfigKey, waitingStatus string, onSuccess func() error) error {
26+
func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, configKey git_commands.GpgConfigKey, waitingStatus string, onSuccess func() error, refreshScope []types.RefreshableView) error {
2727
useSubprocess := self.c.Git().Config.NeedsGpgSubprocess(configKey)
2828
if useSubprocess {
2929
success, err := self.c.RunSubprocess(cmdObj)
@@ -32,20 +32,20 @@ func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, configKey git_
3232
return err
3333
}
3434
}
35-
if err := self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}); err != nil {
35+
if err := self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: refreshScope}); err != nil {
3636
return err
3737
}
3838

3939
return err
4040
} else {
41-
return self.runAndStream(cmdObj, waitingStatus, onSuccess)
41+
return self.runAndStream(cmdObj, waitingStatus, onSuccess, refreshScope)
4242
}
4343
}
4444

45-
func (self *GpgHelper) runAndStream(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error {
45+
func (self *GpgHelper) runAndStream(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error, refreshScope []types.RefreshableView) error {
4646
return self.c.WithWaitingStatus(waitingStatus, func(gocui.Task) error {
4747
if err := cmdObj.StreamOutput().Run(); err != nil {
48-
_ = self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
48+
_ = self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: refreshScope})
4949
return fmt.Errorf(
5050
self.c.Tr.GitCommandFailed, self.c.UserConfig().Keybinding.Universal.ExtrasMenu,
5151
)
@@ -57,6 +57,6 @@ func (self *GpgHelper) runAndStream(cmdObj oscommands.ICmdObj, waitingStatus str
5757
}
5858
}
5959

60-
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
60+
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: refreshScope})
6161
})
6262
}

pkg/gui/controllers/helpers/tags_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (self *TagsHelper) OpenCreateTagPrompt(ref string, onCreate func()) error {
3636
return self.gpg.WithGpgHandling(command, git_commands.TagGpgSign, self.c.Tr.CreatingTag, func() error {
3737
self.commitsHelper.OnCommitSuccess()
3838
return nil
39-
})
39+
}, []types.RefreshableView{types.COMMITS, types.TAGS})
4040
}
4141

4242
onConfirm := func(tagName string, description string) error {

pkg/gui/controllers/helpers/working_tree_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (self *WorkingTreeHelper) handleCommit(summary string, description string,
116116
func() error {
117117
self.commitsHelper.OnCommitSuccess()
118118
return nil
119-
})
119+
}, nil)
120120
}
121121

122122
func (self *WorkingTreeHelper) switchFromCommitMessagePanelToEditor(filepath string, forceSkipHooks bool) error {

pkg/gui/controllers/local_commits_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ func (self *LocalCommitsController) handleReword(summary string, description str
414414
// we've selected the top commit so no rebase is required
415415
return self.c.Helpers().GPG.WithGpgHandling(self.c.Git().Commit.RewordLastCommit(summary, description),
416416
git_commands.CommitGpgSign,
417-
self.c.Tr.RewordingStatus, nil)
417+
self.c.Tr.RewordingStatus, nil, nil)
418418
}
419419

420420
return self.c.WithWaitingStatus(self.c.Tr.RewordingStatus, func(gocui.Task) error {

0 commit comments

Comments
 (0)