Skip to content

Commit

Permalink
Using GPG helper for merge commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed Aug 17, 2024
1 parent 8625152 commit f3544d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/gui/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func (gui *Gui) resetHelpersAndControllers() {
refsHelper := helpers.NewRefsHelper(helperCommon)
suggestionsHelper := helpers.NewSuggestionsHelper(helperCommon)
worktreeHelper := helpers.NewWorktreeHelper(helperCommon, reposHelper, refsHelper, suggestionsHelper)

rebaseHelper := helpers.NewMergeAndRebaseHelper(helperCommon, refsHelper)
gpgHelper := helpers.NewGpgHelper(helperCommon)
rebaseHelper := helpers.NewMergeAndRebaseHelper(helperCommon, refsHelper, gpgHelper)

setCommitSummary := gui.getCommitMessageSetTextareaTextFn(func() *gocui.View { return gui.Views.CommitMessage })
setCommitDescription := gui.getCommitMessageSetTextareaTextFn(func() *gocui.View { return gui.Views.CommitDescription })
Expand All @@ -53,7 +53,6 @@ func (gui *Gui) resetHelpersAndControllers() {
setCommitDescription,
)

gpgHelper := helpers.NewGpgHelper(helperCommon)
viewHelper := helpers.NewViewHelper(helperCommon, gui.State.Contexts)
patchBuildingHelper := helpers.NewPatchBuildingHelper(helperCommon)
stagingHelper := helpers.NewStagingHelper(helperCommon)
Expand Down
5 changes: 4 additions & 1 deletion pkg/gui/controllers/helpers/merge_and_rebase_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ import (
type MergeAndRebaseHelper struct {
c *HelperCommon
refsHelper *RefsHelper
gpgHelper *GpgHelper
}

func NewMergeAndRebaseHelper(
c *HelperCommon,
refsHelper *RefsHelper,
gpgHelper *GpgHelper,
) *MergeAndRebaseHelper {
return &MergeAndRebaseHelper{
c: c,
refsHelper: refsHelper,
gpgHelper: gpgHelper,
}
}

Expand Down Expand Up @@ -127,7 +130,7 @@ func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error {
var result error
runCmd := self.c.Git().Rebase.GenericMergeOrRebaseActionCmdObj(commandType, command)
if self.c.Git().Config.UsingGpg() && command != REBASE_OPTION_ABORT {
result = self.c.RunSubprocessAndRefresh(runCmd)
result = self.gpgHelper.WithGpgHandling(runCmd, self.c.Tr.CommittingStatus, nil)
} else {
result = self.c.Git().Rebase.AddSkipEditorCommand(runCmd).Run()
}
Expand Down

0 comments on commit f3544d7

Please sign in to comment.