diff options
author | Mark Sagi-Kazar <mark.sagikazar@gmail.com> | 2021-11-14 14:31:35 +0100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-12-25 12:01:55 +1100 |
commit | fdf0d4a2c3f1112b5b9063ac9a73f18fab2362ef (patch) | |
tree | 2b74a0ddbb3acbbffb30c0e02551ad2bfbf36571 | |
parent | b4ea565c99a91f701db24ca5a886da40de84dc0b (diff) |
implement signoff
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
-rw-r--r-- | pkg/gui/commit_message_panel.go | 10 | ||||
-rw-r--r-- | pkg/gui/files_panel.go | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index edc86eff7..b3c1d635a 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -14,13 +14,17 @@ func (gui *Gui) handleCommitConfirm() error { if message == "" { return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr) } - flags := "" + flags := []string{} skipHookPrefix := gui.Config.GetUserConfig().Git.SkipHookPrefix if skipHookPrefix != "" && strings.HasPrefix(message, skipHookPrefix) { - flags = "--no-verify" + flags = append(flags, "--no-verify") } - cmdStr := gui.GitCommand.CommitCmdStr(message, flags) + if gui.Config.GetUserConfig().Git.Commit.SignOff { + flags = append(flags, "--signoff") + } + + cmdStr := gui.GitCommand.CommitCmdStr(message, strings.Join(flags, " ")) gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdStr, gui.Tr.Spans.Commit, true)) _ = gui.returnFromContext() return gui.withGpgHandling(cmdStr, gui.Tr.CommittingStatus, func() error { diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index a6f6a9f08..3bc600420 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -458,8 +458,14 @@ func (gui *Gui) handleCommitEditorPress() error { return gui.promptToStageAllAndRetry(gui.handleCommitEditorPress) } + args := []string{"commit"} + + if gui.Config.GetUserConfig().Git.Commit.SignOff { + args = append(args, "--signoff") + } + return gui.runSubprocessWithSuspenseAndRefresh( - gui.OSCommand.WithSpan(gui.Tr.Spans.Commit).PrepareSubProcess("git", "commit"), + gui.OSCommand.WithSpan(gui.Tr.Spans.Commit).PrepareSubProcess("git", args...), ) } |