Repository: jesseduffield/lazygit (language: go)

Issue:
Copying the commit author adds single ticks in wrong places
**Describe the bug**
When copying author name (and e-mail), Lazygit adds single ticks around the coppied string; however, last ticks lands just before the closing angle bracket.

So instead of copying `'Eduard <korchmar.eduard+git@gmail.com>'`, it would end up with `'Eduard <korchmar.eduard+git@gmail.com'>`.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to Commits panel in any repo with commits
2. Press `y` (copy commit attribute) and `a` (copy commit author)
3. Go into any text editor, shell or editable text field inside Lazygit
4. Paste the clipboard content and see the malformed author string.

**Expected behavior**
Added ticks surround the entire copied string.

**Screenshots**
![image](https://github.com/user-attachments/assets/6b72b970-31fe-4e20-9ac4-42347f34a549)

**Version info:**
_Run `lazygit --version` and paste the result here_
commit=v0.44.1, build date=2024-09-18T13:19:48Z, build source=binaryRelease, version=0.44.1, os=linux, arch=amd64, git version=2.46.1
_Run `git --version` and paste the result here_
git version 2.46.1

The bug is also observable in manually built binary from the current latest commit.

**Additional context**
I do not understand why ticks are being added at all, but I assume for portability? I will assume this is intended and useful.

<!--
If you want to try and debug this issue yourself, you can run `lazygit --debug` in one terminal panel and `lazygit --logs` in another to view the logs.
-->



Discussion / hints:

Fix patch:
diff --git a/pkg/commands/git_commands/commit.go b/pkg/commands/git_commands/commit.go
index 45582c6bd5f..52a65fb6dbd 100644
--- a/pkg/commands/git_commands/commit.go
+++ b/pkg/commands/git_commands/commit.go
@@ -189,7 +189,7 @@ type Author struct {
 
 func (self *CommitCommands) GetCommitAuthor(commitHash string) (Author, error) {
 	cmdArgs := NewGitCmd("show").
-		Arg("--no-patch", "--pretty=format:'%an%x00%ae'", commitHash).
+		Arg("--no-patch", "--pretty=format:%an%x00%ae", commitHash).
 		ToArgv()
 
 	output, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()


Test patch:
diff --git a/pkg/integration/tests/commit/copy_author_to_clipboard.go b/pkg/integration/tests/commit/copy_author_to_clipboard.go
new file mode 100644
index 00000000000..9e182265f27
--- /dev/null
+++ b/pkg/integration/tests/commit/copy_author_to_clipboard.go
@@ -0,0 +1,48 @@
+package commit
+
+import (
+	"github.com/jesseduffield/lazygit/pkg/config"
+	. "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+// We're emulating the clipboard by writing to a file called clipboard
+
+var CopyAuthorToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
+	Description:  "Copy a commit author name to the clipboard",
+	ExtraCmdArgs: []string{},
+	Skip:         false,
+	SetupConfig: func(config *config.AppConfig) {
+		// Include delimiters around the text so that we can assert on the entire content
+		config.GetUserConfig().OS.CopyToClipboardCmd = "echo /{{text}}/ > clipboard"
+	},
+
+	SetupRepo: func(shell *Shell) {
+		shell.SetAuthor("John Doe", "john@doe.com")
+		shell.EmptyCommit("commit")
+	},
+
+	Run: func(t *TestDriver, keys config.KeybindingConfig) {
+		t.Views().Commits().
+			Focus().
+			Lines(
+				Contains("commit").IsSelected(),
+			).
+			Press(keys.Commits.CopyCommitAttributeToClipboard)
+
+		t.ExpectPopup().Menu().
+			Title(Equals("Copy to clipboard")).
+			Select(Contains("Commit author")).
+			Confirm()
+
+		t.ExpectToast(Equals("Commit author copied to clipboard"))
+
+		t.Views().Files().
+			Focus().
+			Press(keys.Files.RefreshFiles).
+			Lines(
+				Contains("clipboard").IsSelected(),
+			)
+
+		t.Views().Main().Content(Contains("/John Doe <john@doe.com>/"))
+	},
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index db79247ffea..281b0a2b3db 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -87,6 +87,7 @@ var tests = []*components.IntegrationTest{
 	commit.CommitWithGlobalPrefix,
 	commit.CommitWithNonMatchingBranchName,
 	commit.CommitWithPrefix,
+	commit.CopyAuthorToClipboard,
 	commit.CreateAmendCommit,
 	commit.CreateFixupCommitInBranchStack,
 	commit.CreateTag,