mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Always append -- to git show command
It is good practice to use a -- argument even if no further arguments follow. Doesn't really make a difference for this particular command though, I think.
This commit is contained in:
@ -270,7 +270,8 @@ func (self *CommitCommands) ShowCmdObj(hash string, filterPath string) *oscomman
|
|||||||
Arg(hash).
|
Arg(hash).
|
||||||
ArgIf(self.UserConfig().Git.IgnoreWhitespaceInDiffView, "--ignore-all-space").
|
ArgIf(self.UserConfig().Git.IgnoreWhitespaceInDiffView, "--ignore-all-space").
|
||||||
Arg(fmt.Sprintf("--find-renames=%d%%", self.UserConfig().Git.RenameSimilarityThreshold)).
|
Arg(fmt.Sprintf("--find-renames=%d%%", self.UserConfig().Git.RenameSimilarityThreshold)).
|
||||||
ArgIf(filterPath != "", "--", filterPath).
|
Arg("--").
|
||||||
|
ArgIf(filterPath != "", filterPath).
|
||||||
Dir(self.repoPaths.worktreePath).
|
Dir(self.repoPaths.worktreePath).
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ func TestCommitShowCmdObj(t *testing.T) {
|
|||||||
similarityThreshold: 50,
|
similarityThreshold: 50,
|
||||||
ignoreWhitespace: false,
|
ignoreWhitespace: false,
|
||||||
extDiffCmd: "",
|
extDiffCmd: "",
|
||||||
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%"},
|
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%", "--"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: "Default case with filter path",
|
testName: "Default case with filter path",
|
||||||
@ -285,7 +285,7 @@ func TestCommitShowCmdObj(t *testing.T) {
|
|||||||
similarityThreshold: 50,
|
similarityThreshold: 50,
|
||||||
ignoreWhitespace: false,
|
ignoreWhitespace: false,
|
||||||
extDiffCmd: "",
|
extDiffCmd: "",
|
||||||
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%"},
|
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%", "--"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: "Show diff with custom similarity threshold",
|
testName: "Show diff with custom similarity threshold",
|
||||||
@ -294,7 +294,7 @@ func TestCommitShowCmdObj(t *testing.T) {
|
|||||||
similarityThreshold: 33,
|
similarityThreshold: 33,
|
||||||
ignoreWhitespace: false,
|
ignoreWhitespace: false,
|
||||||
extDiffCmd: "",
|
extDiffCmd: "",
|
||||||
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=33%"},
|
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=33%", "--"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: "Show diff, ignoring whitespace",
|
testName: "Show diff, ignoring whitespace",
|
||||||
@ -303,7 +303,7 @@ func TestCommitShowCmdObj(t *testing.T) {
|
|||||||
similarityThreshold: 50,
|
similarityThreshold: 50,
|
||||||
ignoreWhitespace: true,
|
ignoreWhitespace: true,
|
||||||
extDiffCmd: "",
|
extDiffCmd: "",
|
||||||
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--ignore-all-space", "--find-renames=50%"},
|
expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--ignore-all-space", "--find-renames=50%", "--"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: "Show diff with external diff command",
|
testName: "Show diff with external diff command",
|
||||||
@ -312,7 +312,7 @@ func TestCommitShowCmdObj(t *testing.T) {
|
|||||||
similarityThreshold: 50,
|
similarityThreshold: 50,
|
||||||
ignoreWhitespace: false,
|
ignoreWhitespace: false,
|
||||||
extDiffCmd: "difft --color=always",
|
extDiffCmd: "difft --color=always",
|
||||||
expected: []string{"-C", "/path/to/worktree", "-c", "diff.external=difft --color=always", "-c", "diff.noprefix=false", "show", "--ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%"},
|
expected: []string{"-C", "/path/to/worktree", "-c", "diff.external=difft --color=always", "-c", "diff.noprefix=false", "show", "--ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%", "--"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user