mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-12 14:04:05 -08:00
fix(git): detect upstream-gone status correctly
This commit is contained in:
parent
693111c0c6
commit
0c7afaa7f7
|
@ -265,6 +265,8 @@ func (g *Git) setGitStatus() {
|
||||||
UPSTREAM = "# branch.upstream "
|
UPSTREAM = "# branch.upstream "
|
||||||
BRANCHSTATUS = "# branch.ab "
|
BRANCHSTATUS = "# branch.ab "
|
||||||
)
|
)
|
||||||
|
// firstly assume that upstream is gone
|
||||||
|
g.UpstreamGone = true
|
||||||
g.Working = &GitStatus{}
|
g.Working = &GitStatus{}
|
||||||
g.Staging = &GitStatus{}
|
g.Staging = &GitStatus{}
|
||||||
output := g.getGitCommandOutput("status", "-unormal", "--branch", "--porcelain=2")
|
output := g.getGitCommandOutput("status", "-unormal", "--branch", "--porcelain=2")
|
||||||
|
|
|
@ -374,10 +374,11 @@ func TestSetGitStatus(t *testing.T) {
|
||||||
1 .U N...
|
1 .U N...
|
||||||
1 A. N...
|
1 A. N...
|
||||||
`,
|
`,
|
||||||
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Modified: 4, Added: 2, Deleted: 1, Unmerged: 1}},
|
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Modified: 4, Added: 2, Deleted: 1, Unmerged: 1}},
|
||||||
ExpectedStaging: &GitStatus{ScmStatus: ScmStatus{Added: 1}},
|
ExpectedStaging: &GitStatus{ScmStatus: ScmStatus{Added: 1}},
|
||||||
ExpectedHash: "1234567",
|
ExpectedHash: "1234567",
|
||||||
ExpectedRef: "rework-git-status",
|
ExpectedRef: "rework-git-status",
|
||||||
|
ExpectedUpstreamGone: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Case: "all different options on working and staging, with remote",
|
Case: "all different options on working and staging, with remote",
|
||||||
|
|
Loading…
Reference in a new issue