From 0fc58a79867ae91ce8c0374ecfe95407b621ce55 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 2 Mar 2020 21:17:16 +1100 Subject: [PATCH] fix test --- pkg/commands/git.go | 2 +- pkg/commands/git_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 37a5525ea..3d9cd7be6 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -605,7 +605,7 @@ func (c *GitCommand) DiffCmdStr(file *File, plain bool, cached bool) string { colorArg = "never" } - return fmt.Sprintf("git diff --stat -p --color=%s %s %s %s", colorArg, cachedArg, trackedArg, fileName) + return fmt.Sprintf("git diff --color=%s %s %s %s", colorArg, cachedArg, trackedArg, fileName) } func (c *GitCommand) ApplyPatch(patch string, flags ...string) error { diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 02ed6839b..1f6ef2218 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -1449,7 +1449,7 @@ func TestGitCommandGetBranchGraph(t *testing.T) { gitCmd := NewDummyGitCommand() gitCmd.OSCommand.command = func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"log", "--graph", "--color", "--abbrev-commit", "--decorate", "--date=relative", "--pretty=medium", "test"}, args) + assert.EqualValues(t, []string{"log", "--graph", "--color=always", "--abbrev-commit", "--decorate", "--date=relative", "--pretty=medium", "test"}, args) return exec.Command("echo") } @@ -1473,7 +1473,7 @@ func TestGitCommandDiff(t *testing.T) { "Default case", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"diff", "--stat", "-p", "--color", "--", "test.txt"}, args) + assert.EqualValues(t, []string{"diff", "--color=", "--", "test.txt"}, args) return exec.Command("echo") }, @@ -1489,7 +1489,7 @@ func TestGitCommandDiff(t *testing.T) { "cached", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"diff", "--stat", "-p", "--color", "--cached", "--", "test.txt"}, args) + assert.EqualValues(t, []string{"diff", "--color=", "--cached", "--", "test.txt"}, args) return exec.Command("echo") }, @@ -1505,7 +1505,7 @@ func TestGitCommandDiff(t *testing.T) { "plain", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"diff", "--stat", "-p", "--", "test.txt"}, args) + assert.EqualValues(t, []string{"diff", "--color=never", "--", "test.txt"}, args) return exec.Command("echo") }, @@ -1521,7 +1521,7 @@ func TestGitCommandDiff(t *testing.T) { "File not tracked and file has no staged changes", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"diff", "--stat", "-p", "--color", "--no-index", "/dev/null", "test.txt"}, args) + assert.EqualValues(t, []string{"diff", "--color=", "--no-index", "/dev/null", "test.txt"}, args) return exec.Command("echo") }, @@ -1871,7 +1871,7 @@ func TestGitCommandShowCommitFile(t *testing.T) { "hello.txt", test.CreateMockCommand(t, []*test.CommandSwapper{ { - Expect: "git show --no-renames 123456 -- hello.txt", + Expect: "git show --no-renames --color=never 123456 -- hello.txt", Replace: "echo -n hello", }, }),