mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-28 11:31:04 -08:00
fix(git): initialize status correctly
This commit is contained in:
parent
f25ade45cf
commit
d9e642a132
|
@ -280,6 +280,8 @@ func (g *git) setGitStatus() {
|
||||||
UPSTREAM = "# branch.upstream "
|
UPSTREAM = "# branch.upstream "
|
||||||
BRANCHSTATUS = "# branch.ab "
|
BRANCHSTATUS = "# branch.ab "
|
||||||
)
|
)
|
||||||
|
g.Working = &GitStatus{}
|
||||||
|
g.Staging = &GitStatus{}
|
||||||
output := g.getGitCommandOutput("status", "-unormal", "--branch", "--porcelain=2")
|
output := g.getGitCommandOutput("status", "-unormal", "--branch", "--porcelain=2")
|
||||||
for _, line := range strings.Split(output, "\n") {
|
for _, line := range strings.Split(output, "\n") {
|
||||||
if strings.HasPrefix(line, HASH) {
|
if strings.HasPrefix(line, HASH) {
|
||||||
|
|
|
@ -364,8 +364,6 @@ func TestSetGitStatus(t *testing.T) {
|
||||||
if tc.ExpectedStaging == nil {
|
if tc.ExpectedStaging == nil {
|
||||||
tc.ExpectedStaging = &GitStatus{}
|
tc.ExpectedStaging = &GitStatus{}
|
||||||
}
|
}
|
||||||
g.Working = &GitStatus{}
|
|
||||||
g.Staging = &GitStatus{}
|
|
||||||
g.setGitStatus()
|
g.setGitStatus()
|
||||||
assert.Equal(t, tc.ExpectedStaging, g.Staging, tc.Case)
|
assert.Equal(t, tc.ExpectedStaging, g.Staging, tc.Case)
|
||||||
assert.Equal(t, tc.ExpectedWorking, g.Working, tc.Case)
|
assert.Equal(t, tc.ExpectedWorking, g.Working, tc.Case)
|
||||||
|
|
Loading…
Reference in a new issue