mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
refactor: make true string constant
This commit is contained in:
parent
1298129b87
commit
54c5262a27
|
@ -113,6 +113,8 @@ const (
|
||||||
DETACHED = "(detached)"
|
DETACHED = "(detached)"
|
||||||
BRANCHPREFIX = "ref: refs/heads/"
|
BRANCHPREFIX = "ref: refs/heads/"
|
||||||
GITCOMMAND = "git"
|
GITCOMMAND = "git"
|
||||||
|
|
||||||
|
trueStr = "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Git struct {
|
type Git struct {
|
||||||
|
@ -278,7 +280,7 @@ func (g *Git) shouldDisplay() bool {
|
||||||
}
|
}
|
||||||
g.realDir = g.env.Pwd()
|
g.realDir = g.env.Pwd()
|
||||||
bare := g.getGitCommandOutput("rev-parse", "--is-bare-repository")
|
bare := g.getGitCommandOutput("rev-parse", "--is-bare-repository")
|
||||||
if bare == "true" {
|
if bare == trueStr {
|
||||||
g.IsBare = true
|
g.IsBare = true
|
||||||
g.workingDir = g.realDir
|
g.workingDir = g.realDir
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -165,7 +165,7 @@ func TestEnabledInBareRepo(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
Case: "Bare repo on main",
|
Case: "Bare repo on main",
|
||||||
IsBare: "true",
|
IsBare: trueStr,
|
||||||
HEAD: "ref: refs/heads/main",
|
HEAD: "ref: refs/heads/main",
|
||||||
ExpectedEnabled: true,
|
ExpectedEnabled: true,
|
||||||
ExpectedHEAD: "main",
|
ExpectedHEAD: "main",
|
||||||
|
@ -176,7 +176,7 @@ func TestEnabledInBareRepo(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Case: "Bare repo on main remote enabled",
|
Case: "Bare repo on main remote enabled",
|
||||||
IsBare: "true",
|
IsBare: trueStr,
|
||||||
HEAD: "ref: refs/heads/main",
|
HEAD: "ref: refs/heads/main",
|
||||||
ExpectedEnabled: true,
|
ExpectedEnabled: true,
|
||||||
ExpectedHEAD: "main",
|
ExpectedHEAD: "main",
|
||||||
|
|
Loading…
Reference in a new issue