summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-04-13 21:47:59 +1000
committerGitHub <noreply@github.com>2023-04-13 21:47:59 +1000
commit82c54ed3d2339d2653dd8d06a39bcfb0d5e6cbe0 (patch)
treec907a70ef2744e9e7487a7e014e1c3bdb7f1ffca
parentbd62b519de69838b063c42da6ab7f1fdf92460d2 (diff)
parent6ffe98abacc1040a61e5a7eb532ff89153ebe888 (diff)
Merge pull request #2544 from scallaway/git-diff-detect-renames
-rw-r--r--pkg/commands/git_commands/commit.go2
-rw-r--r--pkg/commands/git_commands/commit_test.go15
2 files changed, 12 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 713c9fffa..268e44e46 100644
--- a/pkg/commands/git_commands/commit_test.go
+++ b/pkg/commands/git_commands/commit_test.go
@@ -190,21 +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: 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 --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 --stat -p 1234567890 --ignore-all-space",
},
}