From acf07e2bbc1790fd7374442f4f86e3b073025035 Mon Sep 17 00:00:00 2001 From: Chris McDonnell Date: Tue, 9 Dec 2025 00:11:35 -0500 Subject: [PATCH] Inline self.signoffFlag helper --- pkg/commands/git_commands/commit.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/commands/git_commands/commit.go b/pkg/commands/git_commands/commit.go index 85067b622..57251b9c8 100644 --- a/pkg/commands/git_commands/commit.go +++ b/pkg/commands/git_commands/commit.go @@ -90,7 +90,7 @@ func (self *CommitCommands) CommitCmdObj(summary string, description string, for skipHookPrefix := self.UserConfig().Git.SkipHookPrefix cmdArgs := NewGitCmd("commit"). ArgIf(forceSkipHooks || (skipHookPrefix != "" && strings.HasPrefix(summary, skipHookPrefix)), "--no-verify"). - ArgIf(self.signoffFlag() != "", self.signoffFlag()). + ArgIf(self.UserConfig().Git.Commit.SignOff, "--signoff"). Arg(messageArgs...). ToArgv() @@ -111,7 +111,7 @@ func (self *CommitCommands) CommitInEditorWithMessageFileCmdObj(tmpMessageFile s ArgIf(forceSkipHooks, "--no-verify"). Arg("--edit"). Arg("--file="+tmpMessageFile). - ArgIf(self.signoffFlag() != "", self.signoffFlag()). + ArgIf(self.UserConfig().Git.Commit.SignOff, "--signoff"). ToArgv()) } @@ -140,19 +140,12 @@ func (self *CommitCommands) commitMessageArgs(summary string, description string // runs git commit without the -m argument meaning it will invoke the user's editor func (self *CommitCommands) CommitEditorCmdObj() *oscommands.CmdObj { cmdArgs := NewGitCmd("commit"). - ArgIf(self.signoffFlag() != "", self.signoffFlag()). + ArgIf(self.UserConfig().Git.Commit.SignOff, "--signoff"). ToArgv() return self.cmd.New(cmdArgs) } -func (self *CommitCommands) signoffFlag() string { - if self.UserConfig().Git.Commit.SignOff { - return "--signoff" - } - return "" -} - func (self *CommitCommands) GetCommitMessage(commitHash string) (string, error) { cmdArgs := NewGitCmd("log"). Arg("--format=%B", "--max-count=1", commitHash).