mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2026-08-24 10:14:12 -05:00
fix(git): reflect staged new files (A.) in Working status
resolves #7386
This commit is contained in:
committed by
Jan De Dobbeleer
parent
72e23f2d34
commit
353a182617
@@ -1,6 +1,6 @@
|
||||
lockfile_version: '1'
|
||||
generated_at: '2026-03-11T11:40:09.315428+00:00'
|
||||
apm_version: 0.7.7
|
||||
generated_at: '2026-03-15T08:59:17.859220+00:00'
|
||||
apm_version: 0.7.9
|
||||
dependencies:
|
||||
- repo_url: JanDeDobbeleer/agentic
|
||||
host: github.com
|
||||
@@ -9,7 +9,6 @@ dependencies:
|
||||
is_virtual: true
|
||||
package_type: claude_skill
|
||||
deployed_files:
|
||||
- .claude/skills/conventional-commit
|
||||
- .github/skills/conventional-commit
|
||||
- repo_url: JanDeDobbeleer/agentic
|
||||
host: github.com
|
||||
@@ -18,7 +17,6 @@ dependencies:
|
||||
is_virtual: true
|
||||
package_type: claude_skill
|
||||
deployed_files:
|
||||
- .claude/skills/golang
|
||||
- .github/skills/golang
|
||||
- repo_url: JanDeDobbeleer/agentic
|
||||
host: github.com
|
||||
@@ -27,7 +25,6 @@ dependencies:
|
||||
is_virtual: true
|
||||
package_type: claude_skill
|
||||
deployed_files:
|
||||
- .claude/skills/markdown
|
||||
- .github/skills/markdown
|
||||
- repo_url: JanDeDobbeleer/agentic
|
||||
host: github.com
|
||||
@@ -36,5 +33,4 @@ dependencies:
|
||||
is_virtual: true
|
||||
package_type: claude_skill
|
||||
deployed_files:
|
||||
- .claude/skills/powershell
|
||||
- .github/skills/powershell
|
||||
@@ -740,6 +740,11 @@ func (g *Git) setStatus() {
|
||||
stagingCode := status[2:3]
|
||||
g.Working.add(workingCode)
|
||||
g.Staging.add(stagingCode)
|
||||
// A newly staged file (A.) exists in the working directory but hasn't been committed yet.
|
||||
// Reflect it in Working so that templates tracking only Working can see the new file.
|
||||
if stagingCode == "A" && workingCode == "." {
|
||||
g.Working.add("A")
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -469,7 +469,7 @@ func TestSetGitStatus(t *testing.T) {
|
||||
1 .U N...
|
||||
1 A. N...
|
||||
`,
|
||||
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Modified: 4, Added: 2, Deleted: 1, Unmerged: 1}},
|
||||
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Modified: 4, Added: 3, Deleted: 1, Unmerged: 1}},
|
||||
ExpectedStaging: &GitStatus{ScmStatus: ScmStatus{Added: 1}},
|
||||
ExpectedHash: "1234567",
|
||||
ExpectedRef: "rework-git-status",
|
||||
@@ -492,7 +492,7 @@ func TestSetGitStatus(t *testing.T) {
|
||||
1 .U N...
|
||||
1 A. N...
|
||||
`,
|
||||
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Modified: 4, Added: 2, Deleted: 1, Unmerged: 1}},
|
||||
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Modified: 4, Added: 3, Deleted: 1, Unmerged: 1}},
|
||||
ExpectedStaging: &GitStatus{ScmStatus: ScmStatus{Added: 1}},
|
||||
ExpectedUpstream: "origin/rework-git-status",
|
||||
ExpectedHash: "1234567",
|
||||
@@ -586,6 +586,26 @@ func TestSetGitStatus(t *testing.T) {
|
||||
Merge: true,
|
||||
ExpectedStaging: &GitStatus{ScmStatus: ScmStatus{Unmerged: 4}},
|
||||
},
|
||||
{
|
||||
Case: "staged new file also appears in working",
|
||||
Output: `
|
||||
# branch.oid 1234567891011121314
|
||||
# branch.head main
|
||||
# branch.upstream origin/main
|
||||
# branch.ab +0 -0
|
||||
1 .M N...
|
||||
1 A. N...
|
||||
? untracked1
|
||||
? untracked2
|
||||
? untracked3
|
||||
? untracked4
|
||||
`,
|
||||
ExpectedUpstream: "origin/main",
|
||||
ExpectedHash: "1234567",
|
||||
ExpectedRef: "main",
|
||||
ExpectedWorking: &GitStatus{ScmStatus: ScmStatus{Modified: 1, Added: 1, Untracked: 4}},
|
||||
ExpectedStaging: &GitStatus{ScmStatus: ScmStatus{Added: 1}},
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
env := new(mock.Environment)
|
||||
|
||||
Reference in New Issue
Block a user