mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-26 11:34:04 -08:00
parent
ddd120178d
commit
fbc21b8c97
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue