diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-04-23 12:31:43 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-04-25 08:50:30 +0200 |
commit | 496308e0230749bd543a78b70fd9ace8a74f0fc5 (patch) | |
tree | 1ec97a9cbbb21db35055e781ea8a19ea9b8930a3 | |
parent | 98c569749fb6eb7d55acd8338e633dc583b3ca2e (diff) |
Support external diff command in diffing mode
-rw-r--r-- | pkg/commands/git_commands/diff.go | 6 |
1 files changed, 5 insertions, 1 deletions
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). |