From 046cb942c23022668e7a8b1e418f0418842e06ab Mon Sep 17 00:00:00 2001 From: Scott Callaway <github@scottcallaway.co.uk> Date: Wed, 12 Apr 2023 12:22:16 +0100 Subject: [PATCH 1/2] fix: organise commit test file Pulled this out into a separate commit since it was unrelated to the feature coming behind it. This just cleans up the `commit_test.go` file slightly (for the method that I was working on) so that the tests are built in a way that is slightly more readable - testing each configuration option individually without combining any of them. --- pkg/commands/git_commands/commit_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/commands/git_commands/commit_test.go b/pkg/commands/git_commands/commit_test.go index 713c9fffa..74341bba8 100644 --- a/pkg/commands/git_commands/commit_test.go +++ b/pkg/commands/git_commands/commit_test.go @@ -196,8 +196,8 @@ func TestCommitShowCmdObj(t *testing.T) { testName: "Default case with filter path", filterPath: "file.txt", contextSize: 3, - ignoreWhitespace: true, - expected: `git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 --ignore-all-space -- "file.txt"`, + ignoreWhitespace: false, + expected: `git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 -- "file.txt"`, }, { testName: "Show diff with custom context size", @@ -206,6 +206,13 @@ func TestCommitShowCmdObj(t *testing.T) { ignoreWhitespace: false, expected: "git show --submodule --color=always --unified=77 --no-renames --stat -p 1234567890", }, + { + testName: "Show diff, ignoring whitespace", + filterPath: "", + contextSize: 77, + ignoreWhitespace: true, + expected: "git show --submodule --color=always --unified=77 --no-renames --stat -p 1234567890 --ignore-all-space", + }, } for _, s := range scenarios { From 6ffe98abacc1040a61e5a7eb532ff89153ebe888 Mon Sep 17 00:00:00 2001 From: Scott Callaway <scott.callaway@uipath.com> Date: Thu, 13 Apr 2023 10:57:35 +0100 Subject: [PATCH 2/2] feat: remove --no-renames flag from main panel diffs (to show renamed files) --- pkg/commands/git_commands/commit.go | 2 +- pkg/commands/git_commands/commit_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/commands/git_commands/commit.go b/pkg/commands/git_commands/commit.go index 0a162a6b6..38459e351 100644 --- a/pkg/commands/git_commands/commit.go +++ b/pkg/commands/git_commands/commit.go @@ -160,7 +160,7 @@ func (self *CommitCommands) ShowCmdObj(sha string, filterPath string, ignoreWhit ignoreWhitespaceArg = " --ignore-all-space" } - cmdStr := fmt.Sprintf("git show --submodule --color=%s --unified=%d --no-renames --stat -p %s%s%s", + cmdStr := fmt.Sprintf("git show --submodule --color=%s --unified=%d --stat -p %s%s%s", self.UserConfig.Git.Paging.ColorArg, contextSize, sha, ignoreWhitespaceArg, filterPathArg) return self.cmd.New(cmdStr).DontLog() } diff --git a/pkg/commands/git_commands/commit_test.go b/pkg/commands/git_commands/commit_test.go index 74341bba8..268e44e46 100644 --- a/pkg/commands/git_commands/commit_test.go +++ b/pkg/commands/git_commands/commit_test.go @@ -190,28 +190,28 @@ func TestCommitShowCmdObj(t *testing.T) { filterPath: "", contextSize: 3, ignoreWhitespace: false, - expected: "git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890", + expected: "git show --submodule --color=always --unified=3 --stat -p 1234567890", }, { testName: "Default case with filter path", filterPath: "file.txt", contextSize: 3, ignoreWhitespace: false, - expected: `git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 -- "file.txt"`, + expected: `git show --submodule --color=always --unified=3 --stat -p 1234567890 -- "file.txt"`, }, { testName: "Show diff with custom context size", filterPath: "", contextSize: 77, ignoreWhitespace: false, - expected: "git show --submodule --color=always --unified=77 --no-renames --stat -p 1234567890", + expected: "git show --submodule --color=always --unified=77 --stat -p 1234567890", }, { testName: "Show diff, ignoring whitespace", filterPath: "", contextSize: 77, ignoreWhitespace: true, - expected: "git show --submodule --color=always --unified=77 --no-renames --stat -p 1234567890 --ignore-all-space", + expected: "git show --submodule --color=always --unified=77 --stat -p 1234567890 --ignore-all-space", }, }