mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
parent
fb1ed7f695
commit
84e3bea1ea
|
@ -224,14 +224,14 @@ func (g *git) getUpstreamIcon() string {
|
|||
|
||||
func (g *git) setGitStatus() {
|
||||
addToStatus := func(status string) {
|
||||
if len(status) <= 4 {
|
||||
return
|
||||
}
|
||||
const UNTRACKED = "?"
|
||||
if strings.HasPrefix(status, UNTRACKED) {
|
||||
g.Working.add(UNTRACKED)
|
||||
return
|
||||
}
|
||||
if len(status) <= 4 {
|
||||
return
|
||||
}
|
||||
workingCode := status[3:4]
|
||||
stagingCode := status[2:3]
|
||||
g.Working.add(workingCode)
|
||||
|
|
|
@ -361,6 +361,22 @@ func TestSetGitStatus(t *testing.T) {
|
|||
ExpectedAhead: 2,
|
||||
ExpectedBehind: 1,
|
||||
},
|
||||
{
|
||||
Case: "untracked files",
|
||||
Output: `
|
||||
# branch.oid 1234567891011121314
|
||||
# branch.head main
|
||||
# branch.upstream origin/main
|
||||
# branch.ab +0 -0
|
||||
? q
|
||||
? qq
|
||||
? qqq
|
||||
`,
|
||||
ExpectedUpstream: "origin/main",
|
||||
ExpectedHash: "1234567",
|
||||
ExpectedRef: "main",
|
||||
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Added: 3}},
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
env := new(MockedEnvironment)
|
||||
|
|
Loading…
Reference in a new issue