mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-15 13:17:53 -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 "
|
||||
BRANCHSTATUS = "# branch.ab "
|
||||
)
|
||||
g.Working = &GitStatus{}
|
||||
g.Staging = &GitStatus{}
|
||||
output := g.getGitCommandOutput("status", "-unormal", "--branch", "--porcelain=2")
|
||||
for _, line := range strings.Split(output, "\n") {
|
||||
if strings.HasPrefix(line, HASH) {
|
||||
|
|
|
@ -364,8 +364,6 @@ func TestSetGitStatus(t *testing.T) {
|
|||
if tc.ExpectedStaging == nil {
|
||||
tc.ExpectedStaging = &GitStatus{}
|
||||
}
|
||||
g.Working = &GitStatus{}
|
||||
g.Staging = &GitStatus{}
|
||||
g.setGitStatus()
|
||||
assert.Equal(t, tc.ExpectedStaging, g.Staging, tc.Case)
|
||||
assert.Equal(t, tc.ExpectedWorking, g.Working, tc.Case)
|
||||
|
|
Loading…
Reference in a new issue