Skip to content

Commit

Permalink
fix(git): align git commands with posh-git
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Mar 7, 2021
1 parent 9ffc16a commit f96f7ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/segment_git.go
Expand Up @@ -272,7 +272,7 @@ func (g *git) getStatusColor(defaultValue string) string {
}

func (g *git) getGitCommandOutput(args ...string) string {
args = append([]string{"-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(gitCommand, args...)
return val
}
Expand Down
6 changes: 3 additions & 3 deletions src/segment_git_test.go
Expand Up @@ -54,7 +54,7 @@ func TestEnabledInWorkingTree(t *testing.T) {
}

func TestGetGitOutputForCommand(t *testing.T) {
args := []string{"-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"}
want := "je suis le output"
env := new(MockedEnvironment)
Expand Down Expand Up @@ -113,7 +113,7 @@ func setupHEADContextEnv(context *detachedContext) *git {
}

func (m *MockedEnvironment) mockGitCommand(returnValue string, args ...string) {
args = append([]string{"-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)
}

Expand Down Expand Up @@ -400,7 +400,7 @@ func TestParseGitStatsInvalidLine(t *testing.T) {

func bootstrapUpstreamTest(upstream string) *git {
env := &MockedEnvironment{}
env.On("runCommand", "git", []string{"-c", "core.quotepath=false", "-c", "color.status=false", "remote", "get-url", "origin"}).Return(upstream, nil)
env.On("runCommand", "git", []string{"--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false", "remote", "get-url", "origin"}).Return(upstream, nil)
props := &properties{
values: map[Property]interface{}{
GithubIcon: "GH",
Expand Down

0 comments on commit f96f7ec

Please sign in to comment.