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
|
||||
|
||||
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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue