mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-31 22:07:25 -08:00
parent
f8ec5ab3ae
commit
301ca0b7aa
|
@ -146,9 +146,6 @@ func (g *Git) Template() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Git) Enabled() bool {
|
func (g *Git) Enabled() bool {
|
||||||
statusFormats := g.props.GetKeyValueMap(StatusFormats, map[string]string{})
|
|
||||||
g.Working = &GitStatus{ScmStatus: ScmStatus{Formats: statusFormats}}
|
|
||||||
g.Staging = &GitStatus{ScmStatus: ScmStatus{Formats: statusFormats}}
|
|
||||||
g.User = &User{}
|
g.User = &User{}
|
||||||
|
|
||||||
if !g.shouldDisplay() {
|
if !g.shouldDisplay() {
|
||||||
|
@ -489,8 +486,9 @@ func (g *Git) setGitStatus() {
|
||||||
)
|
)
|
||||||
// firstly assume that upstream is gone
|
// firstly assume that upstream is gone
|
||||||
g.UpstreamGone = true
|
g.UpstreamGone = true
|
||||||
g.Working = &GitStatus{}
|
statusFormats := g.props.GetKeyValueMap(StatusFormats, map[string]string{})
|
||||||
g.Staging = &GitStatus{}
|
g.Working = &GitStatus{ScmStatus: ScmStatus{Formats: statusFormats}}
|
||||||
|
g.Staging = &GitStatus{ScmStatus: ScmStatus{Formats: statusFormats}}
|
||||||
untrackedMode := g.getUntrackedFilesMode()
|
untrackedMode := g.getUntrackedFilesMode()
|
||||||
args := []string{"status", untrackedMode, "--branch", "--porcelain=2"}
|
args := []string{"status", untrackedMode, "--branch", "--porcelain=2"}
|
||||||
ignoreSubmodulesMode := g.getIgnoreSubmodulesMode()
|
ignoreSubmodulesMode := g.getIgnoreSubmodulesMode()
|
||||||
|
|
|
@ -554,6 +554,8 @@ func TestSetGitStatus(t *testing.T) {
|
||||||
if tc.ExpectedStaging == nil {
|
if tc.ExpectedStaging == nil {
|
||||||
tc.ExpectedStaging = &GitStatus{}
|
tc.ExpectedStaging = &GitStatus{}
|
||||||
}
|
}
|
||||||
|
tc.ExpectedStaging.Formats = map[string]string{}
|
||||||
|
tc.ExpectedWorking.Formats = map[string]string{}
|
||||||
g.setGitStatus()
|
g.setGitStatus()
|
||||||
assert.Equal(t, tc.ExpectedStaging, g.Staging, tc.Case)
|
assert.Equal(t, tc.ExpectedStaging, g.Staging, tc.Case)
|
||||||
assert.Equal(t, tc.ExpectedWorking, g.Working, tc.Case)
|
assert.Equal(t, tc.ExpectedWorking, g.Working, tc.Case)
|
||||||
|
|
Loading…
Reference in a new issue