mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
more efficient context diff size changing
This commit is contained in:
@ -120,6 +120,8 @@ func TestGitCommandShowCmdStr(t *testing.T) {
|
||||
expected string
|
||||
}
|
||||
|
||||
gitCmd := NewDummyGitCommand()
|
||||
|
||||
scenarios := []scenario{
|
||||
{
|
||||
testName: "Default case without filter path",
|
||||
@ -131,7 +133,7 @@ func TestGitCommandShowCmdStr(t *testing.T) {
|
||||
testName: "Default case with filter path",
|
||||
filterPath: "file.txt",
|
||||
contextSize: 3,
|
||||
expected: "git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 -- \"file.txt\"",
|
||||
expected: "git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 -- " + gitCmd.OSCommand.Quote("file.txt"),
|
||||
},
|
||||
{
|
||||
testName: "Show diff with custom context size",
|
||||
@ -143,7 +145,6 @@ func TestGitCommandShowCmdStr(t *testing.T) {
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
gitCmd := NewDummyGitCommand()
|
||||
gitCmd.Config.GetUserConfig().Git.DiffContextSize = s.contextSize
|
||||
cmdStr := gitCmd.ShowCmdStr("1234567890", s.filterPath)
|
||||
assert.Equal(t, s.expected, cmdStr)
|
||||
|
@ -444,13 +444,13 @@ func TestGitCommandDiff(t *testing.T) {
|
||||
// TestGitCommandShowFileDiff is a function.
|
||||
func TestGitCommandShowFileDiff(t *testing.T) {
|
||||
type scenario struct {
|
||||
testName string
|
||||
command func(string, ...string) *exec.Cmd
|
||||
from string
|
||||
to string
|
||||
reverse bool
|
||||
plain bool
|
||||
contextSize int
|
||||
testName string
|
||||
command func(string, ...string) *exec.Cmd
|
||||
from string
|
||||
to string
|
||||
reverse bool
|
||||
plain bool
|
||||
contextSize int
|
||||
}
|
||||
|
||||
scenarios := []scenario{
|
||||
@ -489,7 +489,7 @@ func TestGitCommandShowFileDiff(t *testing.T) {
|
||||
gitCmd := NewDummyGitCommand()
|
||||
gitCmd.OSCommand.Command = s.command
|
||||
gitCmd.Config.GetUserConfig().Git.DiffContextSize = s.contextSize
|
||||
gitCmd.ShowFileDiff(s.from, s.to, s.reverse, "test.txt", s.plain)
|
||||
_, _ = gitCmd.ShowFileDiff(s.from, s.to, s.reverse, "test.txt", s.plain)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user