Repository: jesseduffield/lazygit (language: go)

Issue:
Reword loads incorrect commit message/description with commit signing
**Describe the bug**
Since I sign my commits via SSH (not sure if this reproduces with regular GPG signing), rewording a commit will prompt with the new commit message & description, but will incorrectly place values. It actually uses the signature verification as the message, and the message as the description, possibly losing the description. Here is a visible example:

Commit info:
![image](https://github.com/jesseduffield/lazygit/assets/167217/044b23a9-3b1a-4489-bb8f-35ceaade5c98)

Rewording said commit:
![image](https://github.com/jesseduffield/lazygit/assets/167217/0ba129de-8861-419a-9c4f-594209bf3813)

**To Reproduce**
Steps to reproduce the behavior:

1. Enable SSH signing for your git setup
2. Make any commit
3. Attempt to reword said commit
4. See the message/description values

**Version info:**
LazyGit version: `commit=3675570a391b1a49ddd198b4c7e71e17701d4404, build date=2024-03-23T09:09:11Z, build source=binaryRelease, version=0.41.0, os=darwin, arch=amd64, git version=2.39.3 (Apple Git-146)`
Git version: `git version 2.39.3 (Apple Git-146)`

**Additional context**

Related Git config:

```
log.showsignature=true
gpg.format=ssh
gpg.ssh.allowedsignersfile=~/.ssh/allowed_signers
commit.gpgsign=true
user.signingkey=[[MASKED]]
```


Discussion / hints:

Fix patch:
diff --git a/pkg/commands/git_commands/commit.go b/pkg/commands/git_commands/commit.go
index 6bf1985e121..693fe4eba8d 100644
--- a/pkg/commands/git_commands/commit.go
+++ b/pkg/commands/git_commands/commit.go
@@ -158,6 +158,7 @@ func (self *CommitCommands) signoffFlag() string {
 func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error) {
 	cmdArgs := NewGitCmd("log").
 		Arg("--format=%B", "--max-count=1", commitSha).
+		Config("log.showsignature=false").
 		ToArgv()
 
 	message, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
@@ -167,6 +168,7 @@ func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error) {
 func (self *CommitCommands) GetCommitSubject(commitSha string) (string, error) {
 	cmdArgs := NewGitCmd("log").
 		Arg("--format=%s", "--max-count=1", commitSha).
+		Config("log.showsignature=false").
 		ToArgv()
 
 	subject, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()


Test patch:
diff --git a/pkg/commands/git_commands/commit_test.go b/pkg/commands/git_commands/commit_test.go
index 8dc8afa83a6..4dd9322f13a 100644
--- a/pkg/commands/git_commands/commit_test.go
+++ b/pkg/commands/git_commands/commit_test.go
@@ -337,7 +337,7 @@ func TestGetCommitMsg(t *testing.T) {
 		s := s
 		t.Run(s.testName, func(t *testing.T) {
 			instance := buildCommitCommands(commonDeps{
-				runner: oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"log", "--format=%B", "--max-count=1", "deadbeef"}, s.input, nil),
+				runner: oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1", "deadbeef"}, s.input, nil),
 			})
 
 			output, err := instance.GetCommitMessage("deadbeef")
@@ -358,14 +358,14 @@ func TestGetCommitMessageFromHistory(t *testing.T) {
 	scenarios := []scenario{
 		{
 			"Empty message",
-			oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"log", "-1", "--skip=2", "--pretty=%H"}, "", nil).ExpectGitArgs([]string{"log", "--format=%B", "--max-count=1"}, "", nil),
+			oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"log", "-1", "--skip=2", "--pretty=%H"}, "", nil).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1"}, "", nil),
 			func(output string, err error) {
 				assert.Error(t, err)
 			},
 		},
 		{
 			"Default case to retrieve a commit in history",
-			oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"log", "-1", "--skip=2", "--pretty=%H"}, "sha3 \n", nil).ExpectGitArgs([]string{"log", "--format=%B", "--max-count=1", "sha3"}, `use generics to DRY up context code`, nil),
+			oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"log", "-1", "--skip=2", "--pretty=%H"}, "sha3 \n", nil).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1", "sha3"}, `use generics to DRY up context code`, nil),
 			func(output string, err error) {
 				assert.NoError(t, err)
 				assert.Equal(t, "use generics to DRY up context code", output)