summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git_commands/diff.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git_commands/diff.go')
-rw-r--r--pkg/commands/git_commands/diff.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/commands/git_commands/diff.go b/pkg/commands/git_commands/diff.go
index 9f81bb91d..979279914 100644
--- a/pkg/commands/git_commands/diff.go
+++ b/pkg/commands/git_commands/diff.go
@@ -1,6 +1,10 @@
package git_commands
-import "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
+import (
+ "fmt"
+
+ "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
+)
type DiffCommands struct {
*GitCommon
@@ -13,10 +17,16 @@ func NewDiffCommands(gitCommon *GitCommon) *DiffCommands {
}
func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj {
+ extDiffCmd := self.UserConfig.Git.Paging.ExternalDiffCommand
+ useExtDiff := extDiffCmd != ""
+
return self.cmd.New(
NewGitCmd("diff").
Config("diff.noprefix=false").
- Arg("--submodule", "--no-ext-diff", "--color").
+ ConfigIf(useExtDiff, "diff.external="+extDiffCmd).
+ ArgIfElse(useExtDiff, "--ext-diff", "--no-ext-diff").
+ Arg("--submodule").
+ Arg(fmt.Sprintf("--color=%s", self.UserConfig.Git.Paging.ColorArg)).
Arg(diffArgs...).
Dir(self.repoPaths.worktreePath).
ToArgv(),