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