From 496308e0230749bd543a78b70fd9ace8a74f0fc5 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 23 Apr 2024 12:31:43 +0200 Subject: Support external diff command in diffing mode --- pkg/commands/git_commands/diff.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/commands/git_commands/diff.go b/pkg/commands/git_commands/diff.go index 4720d5404..979279914 100644 --- a/pkg/commands/git_commands/diff.go +++ b/pkg/commands/git_commands/diff.go @@ -17,11 +17,15 @@ 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"). + ConfigIf(useExtDiff, "diff.external="+extDiffCmd). + ArgIfElse(useExtDiff, "--ext-diff", "--no-ext-diff"). Arg("--submodule"). - Arg("--no-ext-diff"). Arg(fmt.Sprintf("--color=%s", self.UserConfig.Git.Paging.ColorArg)). Arg(diffArgs...). Dir(self.repoPaths.worktreePath). -- cgit v1.2.3