1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-19 21:28:28 +02:00

Merge pull request #2544 from scallaway/git-diff-detect-renames

This commit is contained in:
Jesse Duffield 2023-04-13 21:47:59 +10:00 committed by GitHub
commit 82c54ed3d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -160,7 +160,7 @@ func (self *CommitCommands) ShowCmdObj(sha string, filterPath string, ignoreWhit
ignoreWhitespaceArg = " --ignore-all-space" 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) self.UserConfig.Git.Paging.ColorArg, contextSize, sha, ignoreWhitespaceArg, filterPathArg)
return self.cmd.New(cmdStr).DontLog() return self.cmd.New(cmdStr).DontLog()
} }

View File

@ -190,21 +190,28 @@ func TestCommitShowCmdObj(t *testing.T) {
filterPath: "", filterPath: "",
contextSize: 3, contextSize: 3,
ignoreWhitespace: false, 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", testName: "Default case with filter path",
filterPath: "file.txt", filterPath: "file.txt",
contextSize: 3, contextSize: 3,
ignoreWhitespace: true, ignoreWhitespace: false,
expected: `git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 --ignore-all-space -- "file.txt"`, expected: `git show --submodule --color=always --unified=3 --stat -p 1234567890 -- "file.txt"`,
}, },
{ {
testName: "Show diff with custom context size", testName: "Show diff with custom context size",
filterPath: "", filterPath: "",
contextSize: 77, contextSize: 77,
ignoreWhitespace: false, 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",
}, },
} }