1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-21 22:43:27 +02:00

Merge pull request #1923 from Ryooooooga/feature/fix-author-name

This commit is contained in:
Jesse Duffield 2022-05-07 23:41:16 +10:00 committed by GitHub
commit 549409a6f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,13 +87,13 @@ type Author struct {
} }
func (self *CommitCommands) GetCommitAuthor(commitSha string) (Author, error) { func (self *CommitCommands) GetCommitAuthor(commitSha string) (Author, error) {
cmdStr := "git show --no-patch --pretty=format:'%an|%ae' " + commitSha cmdStr := "git show --no-patch --pretty=format:'%an%x00%ae' " + commitSha
output, err := self.cmd.New(cmdStr).DontLog().RunWithOutput() output, err := self.cmd.New(cmdStr).DontLog().RunWithOutput()
if err != nil { if err != nil {
return Author{}, err return Author{}, err
} }
split := strings.Split(strings.TrimSpace(output), "|") split := strings.SplitN(strings.TrimSpace(output), "\x00", 2)
if len(split) < 2 { if len(split) < 2 {
return Author{}, errors.New("unexpected git output") return Author{}, errors.New("unexpected git output")
} }