mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
3f046e31a1
commit
434cd41faf
|
@ -23,7 +23,6 @@ type gitStatus struct {
|
|||
deleted int
|
||||
added int
|
||||
modified int
|
||||
untracked int
|
||||
changed bool
|
||||
}
|
||||
|
||||
|
@ -38,7 +37,6 @@ func (s *gitStatus) string() string {
|
|||
status += stringIfValue(s.added, "+")
|
||||
status += stringIfValue(s.modified, "~")
|
||||
status += stringIfValue(s.deleted, "-")
|
||||
status += stringIfValue(s.untracked, "?")
|
||||
status += stringIfValue(s.unmerged, "x")
|
||||
return status
|
||||
}
|
||||
|
@ -384,7 +382,7 @@ func (g *git) parseGitStats(output []string, working bool) *gitStatus {
|
|||
switch code {
|
||||
case "?":
|
||||
if working {
|
||||
status.untracked++
|
||||
status.added++
|
||||
}
|
||||
case "D":
|
||||
status.deleted++
|
||||
|
@ -396,7 +394,7 @@ func (g *git) parseGitStats(output []string, working bool) *gitStatus {
|
|||
status.modified++
|
||||
}
|
||||
}
|
||||
status.changed = status.added > 0 || status.deleted > 0 || status.modified > 0 || status.unmerged > 0 || status.untracked > 0
|
||||
status.changed = status.added > 0 || status.deleted > 0 || status.modified > 0 || status.unmerged > 0
|
||||
return &status
|
||||
}
|
||||
|
||||
|
|
|
@ -352,9 +352,8 @@ func TestParseGitStatsWorking(t *testing.T) {
|
|||
status := g.parseGitStats(output, true)
|
||||
assert.Equal(t, 3, status.modified)
|
||||
assert.Equal(t, 1, status.unmerged)
|
||||
assert.Equal(t, 1, status.added)
|
||||
assert.Equal(t, 3, status.added)
|
||||
assert.Equal(t, 1, status.deleted)
|
||||
assert.Equal(t, 2, status.untracked)
|
||||
assert.True(t, status.changed)
|
||||
}
|
||||
|
||||
|
@ -376,7 +375,6 @@ func TestParseGitStatsStaging(t *testing.T) {
|
|||
assert.Equal(t, 0, status.unmerged)
|
||||
assert.Equal(t, 1, status.added)
|
||||
assert.Equal(t, 2, status.deleted)
|
||||
assert.Equal(t, 0, status.untracked)
|
||||
assert.True(t, status.changed)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue