Skip to content

Commit

Permalink
Allows gpg to run for merge commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder authored and jesseduffield committed Aug 17, 2024
1 parent 9404c23 commit 9bfd585
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 6 additions & 3 deletions pkg/commands/git_commands/rebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (self *RebaseCommands) GenericMergeOrRebaseAction(commandType string, comma
return nil
}

func (self *RebaseCommands) runSkipEditorCommand(cmdObj oscommands.ICmdObj) error {
func (self *RebaseCommands) AddSkipEditorCommand(cmdObj oscommands.ICmdObj) oscommands.ICmdObj {
instruction := daemon.NewExitImmediatelyInstruction()
lazyGitPath := oscommands.GetLazygitPath()
return cmdObj.
Expand All @@ -480,8 +480,11 @@ func (self *RebaseCommands) runSkipEditorCommand(cmdObj oscommands.ICmdObj) erro
"EDITOR="+lazyGitPath,
"VISUAL="+lazyGitPath,
).
AddEnvVars(daemon.ToEnvVars(instruction)...).
Run()
AddEnvVars(daemon.ToEnvVars(instruction)...)
}

func (self *RebaseCommands) runSkipEditorCommand(cmdObj oscommands.ICmdObj) error {
return self.AddSkipEditorCommand(cmdObj).Run()
}

// DiscardOldFileChanges discards changes to a file from an old commit
Expand Down
12 changes: 11 additions & 1 deletion pkg/gui/controllers/helpers/merge_and_rebase_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,17 @@ func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error {
self.c.Git().Rebase.GenericMergeOrRebaseActionCmdObj(commandType, command),
)
}
result := self.c.Git().Rebase.GenericMergeOrRebaseAction(commandType, command)

runCmd := self.c.Git().Rebase.AddSkipEditorCommand(
self.c.Git().Rebase.GenericMergeOrRebaseActionCmdObj(commandType, command))

var result error = nil

Check failure on line 130 in pkg/gui/controllers/helpers/merge_and_rebase_helper.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to result (ineffassign)

Check failure on line 130 in pkg/gui/controllers/helpers/merge_and_rebase_helper.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to result (ineffassign)
if self.c.Git().Config.UsingGpg() && command != REBASE_OPTION_ABORT {
result = self.c.RunSubprocessAndRefresh(runCmd)
} else {
result = runCmd.Run()
}

if err := self.CheckMergeOrRebase(result); err != nil {
return err
}
Expand Down

0 comments on commit 9bfd585

Please sign in to comment.