mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
revert: fetch info from the working directory
This reverts commit cb17bb914a
.
This commit is contained in:
parent
1866adfb88
commit
ae9fb25db6
|
@ -292,7 +292,7 @@ func (g *git) getGitCommand() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *git) getGitCommandOutput(args ...string) string {
|
func (g *git) getGitCommandOutput(args ...string) string {
|
||||||
args = append([]string{"-C", strings.TrimSuffix(g.gitRootFolder, ".git"), "--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...)
|
args = append([]string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...)
|
||||||
val, _ := g.env.runCommand(g.getGitCommand(), args...)
|
val, _ := g.env.runCommand(g.getGitCommand(), args...)
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ func TestEnabledInWorkingTree(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetGitOutputForCommand(t *testing.T) {
|
func TestGetGitOutputForCommand(t *testing.T) {
|
||||||
args := []string{"-C", "test", "--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}
|
args := []string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}
|
||||||
commandArgs := []string{"symbolic-ref", "--short", "HEAD"}
|
commandArgs := []string{"symbolic-ref", "--short", "HEAD"}
|
||||||
want := "je suis le output"
|
want := "je suis le output"
|
||||||
env := new(MockedEnvironment)
|
env := new(MockedEnvironment)
|
||||||
|
@ -69,7 +69,6 @@ func TestGetGitOutputForCommand(t *testing.T) {
|
||||||
env.On("getRuntimeGOOS", nil).Return("unix")
|
env.On("getRuntimeGOOS", nil).Return("unix")
|
||||||
g := &git{
|
g := &git{
|
||||||
env: env,
|
env: env,
|
||||||
gitRootFolder: "test",
|
|
||||||
}
|
}
|
||||||
got := g.getGitCommandOutput(commandArgs...)
|
got := g.getGitCommandOutput(commandArgs...)
|
||||||
assert.Equal(t, want, got)
|
assert.Equal(t, want, got)
|
||||||
|
@ -138,7 +137,7 @@ func setupHEADContextEnv(context *detachedContext) *git {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MockedEnvironment) mockGitCommand(returnValue string, args ...string) {
|
func (m *MockedEnvironment) mockGitCommand(returnValue string, args ...string) {
|
||||||
args = append([]string{"-C", "", "--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...)
|
args = append([]string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...)
|
||||||
m.On("runCommand", "git", args).Return(returnValue, nil)
|
m.On("runCommand", "git", args).Return(returnValue, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +550,7 @@ func TestGitUpstream(t *testing.T) {
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := &MockedEnvironment{}
|
env := &MockedEnvironment{}
|
||||||
env.On("isWsl", nil).Return(false)
|
env.On("isWsl", nil).Return(false)
|
||||||
env.On("runCommand", "git", []string{"-C", "", "--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false", "remote", "get-url", "origin"}).Return(tc.Upstream, nil) //nolint:lll
|
env.On("runCommand", "git", []string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false", "remote", "get-url", "origin"}).Return(tc.Upstream, nil)
|
||||||
env.On("getRuntimeGOOS", nil).Return("unix")
|
env.On("getRuntimeGOOS", nil).Return("unix")
|
||||||
props := &properties{
|
props := &properties{
|
||||||
values: map[Property]interface{}{
|
values: map[Property]interface{}{
|
||||||
|
|
Loading…
Reference in a new issue