mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Support externalDiffCommand in diffing mode (#3519)
- **PR Description** Support `git.paging.externalDiffCommand` config in diffing mode (i.e. when showing the diff between two commits using `W`). Fixes #3518.
This commit is contained in:
commit
aa81e191e2
1 changed files with 12 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
||||||
package git_commands
|
package git_commands
|
||||||
|
|
||||||
import "github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||||
|
)
|
||||||
|
|
||||||
type DiffCommands struct {
|
type DiffCommands struct {
|
||||||
*GitCommon
|
*GitCommon
|
||||||
|
@ -13,10 +17,16 @@ func NewDiffCommands(gitCommon *GitCommon) *DiffCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj {
|
func (self *DiffCommands) DiffCmdObj(diffArgs []string) oscommands.ICmdObj {
|
||||||
|
extDiffCmd := self.UserConfig.Git.Paging.ExternalDiffCommand
|
||||||
|
useExtDiff := extDiffCmd != ""
|
||||||
|
|
||||||
return self.cmd.New(
|
return self.cmd.New(
|
||||||
NewGitCmd("diff").
|
NewGitCmd("diff").
|
||||||
Config("diff.noprefix=false").
|
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...).
|
Arg(diffArgs...).
|
||||||
Dir(self.repoPaths.worktreePath).
|
Dir(self.repoPaths.worktreePath).
|
||||||
ToArgv(),
|
ToArgv(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue