1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-25 00:46:54 +02:00

Fix populating the Commit.Tags field

We now store all tags in this field if there are several.
This commit is contained in:
Stefan Haller
2023-06-21 19:30:25 +02:00
parent cc835a813e
commit 6b769fb138
2 changed files with 23 additions and 17 deletions
pkg/commands/git_commands

@ -162,11 +162,17 @@ func (self *CommitLoader) extractCommitFromLine(line string) *models.Commit {
tags := []string{}
if extraInfo != "" {
re := regexp.MustCompile(`tag: ([^,\)]+)`)
tagMatch := re.FindStringSubmatch(extraInfo)
if len(tagMatch) > 1 {
tags = append(tags, tagMatch[1])
extraInfoFields := strings.Split(extraInfo, ",")
for _, extraInfoField := range extraInfoFields {
extraInfoField = strings.TrimSpace(extraInfoField)
re := regexp.MustCompile(`tag: (.+)`)
tagMatch := re.FindStringSubmatch(extraInfoField)
if len(tagMatch) > 1 {
tags = append(tags, tagMatch[1])
}
}
extraInfo = "(" + extraInfo + ")"
}
unitTimestampInt, _ := strconv.Atoi(unixTimestamp)
@ -585,4 +591,4 @@ func (self *CommitLoader) getLogCmd(opts GetCommitsOptions) oscommands.ICmdObj {
return self.cmd.New(cmdArgs).DontLog()
}
const prettyFormat = `--pretty=format:%H%x00%at%x00%aN%x00%ae%x00%d%x00%p%x00%s`
const prettyFormat = `--pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%s`