diff --git a/src/segments/git.go b/src/segments/git.go index a7df4d44..c7c3232f 100644 --- a/src/segments/git.go +++ b/src/segments/git.go @@ -750,6 +750,7 @@ func (g *Git) setPrettyHEADName() { g.Detached = !strings.HasPrefix(HEADRef, "ref:") if strings.HasPrefix(HEADRef, BRANCHPREFIX) { branchName := strings.TrimPrefix(HEADRef, BRANCHPREFIX) + g.Ref = branchName g.HEAD = fmt.Sprintf("%s%s", g.props.GetString(BranchIcon, "\uE0A0"), g.formatHEAD(branchName)) return } @@ -757,12 +758,14 @@ func (g *Git) setPrettyHEADName() { if len(HEADRef) >= 7 { g.ShortHash = HEADRef[0:7] g.Hash = HEADRef[0:] + g.Ref = g.ShortHash } } // check for tag tagName := g.getGitCommandOutput("describe", "--tags", "--exact-match") if len(tagName) > 0 { + g.Ref = tagName g.HEAD = fmt.Sprintf("%s%s", g.props.GetString(TagIcon, "\uF412"), tagName) return }