mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
pkg/commands: Don't duplicate line breaks when retrieving commit message
When using the "copy commit message to clipboard" action, the message will end up in the clipboard with duplicate line breaks. The same issue also affects the "Reword Commit" command. GetCommitMessage(), the function used to retrieve the commit message first splits the output returned by git into separate lines - without removing the line breaks. After removing the first line (which contains the commit SHA), it joins the lines of the message itself back together - adding a second set of line breaks along the way. Stop this from happening. Fixes #1808.
This commit is contained in:
parent
ac687a5a2a
commit
8fb47fb7d6
2 changed files with 47 additions and 1 deletions
|
@ -70,7 +70,7 @@ func (self *CommitCommands) GetHeadCommitMessage() (string, error) {
|
|||
func (self *CommitCommands) GetCommitMessage(commitSha string) (string, error) {
|
||||
cmdStr := "git rev-list --format=%B --max-count=1 " + commitSha
|
||||
messageWithHeader, err := self.cmd.New(cmdStr).DontLog().RunWithOutput()
|
||||
message := strings.Join(strings.SplitAfter(messageWithHeader, "\n")[1:], "\n")
|
||||
message := strings.Join(strings.SplitAfter(messageWithHeader, "\n")[1:], "")
|
||||
return strings.TrimSpace(message), err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue