Skip to content

Commit 496308e

Browse files
committed
Support external diff command in diffing mode
1 parent 98c5697 commit 496308e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/commands/git_commands/diff.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ func NewDiffCommands(gitCommon *GitCommon) *DiffCommands {
1717
}
1818

1919
func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj {
20+
extDiffCmd := self.UserConfig.Git.Paging.ExternalDiffCommand
21+
useExtDiff := extDiffCmd != ""
22+
2023
return self.cmd.New(
2124
NewGitCmd("diff").
2225
Config("diff.noprefix=false").
26+
ConfigIf(useExtDiff, "diff.external="+extDiffCmd).
27+
ArgIfElse(useExtDiff, "--ext-diff", "--no-ext-diff").
2328
Arg("--submodule").
24-
Arg("--no-ext-diff").
2529
Arg(fmt.Sprintf("--color=%s", self.UserConfig.Git.Paging.ColorArg)).
2630
Arg(diffArgs...).
2731
Dir(self.repoPaths.worktreePath).

0 commit comments

Comments
 (0)