fix: untracked is working area only

This commit is contained in:
Jan De Dobbeleer 2020-10-19 08:54:15 +02:00 committed by Jan De Dobbeleer
parent c41866171d
commit 36b58abdf3
2 changed files with 4 additions and 2 deletions

View file

@ -316,7 +316,9 @@ func (g *git) parseGitStats(output []string, working bool) *gitStatus {
}
switch code {
case "?":
status.untracked++
if working {
status.untracked++
}
case "D":
status.deleted++
case "A":

View file

@ -330,7 +330,7 @@ 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, 1, status.untracked)
assert.Equal(t, 0, status.untracked)
assert.True(t, status.changed)
}