Repository: jesseduffield/lazygit (language: go)

Issue:
externalDiffCommand doesn't work when diffing between 2 refs
**Is your feature request related to a problem? Please describe.**
`externalDiffCommand` currently works wonder when viewing the diff of each commits, but it doesn't work when we're diffing between 2 refs (with `W` key binding). Instead Lazygit used the default diff view

**Describe the solution you'd like**
`externalDiffCommand` should also applies to diff view between to refs.

**Describe alternatives you've considered**
The default diff view is good enough, but I prefer to use difftastic to view the diff.

**Additional context**

Normal diff:
<img width="1897" alt="image" src="https://github.com/jesseduffield/lazygit/assets/78085736/110826d9-d985-49f0-b036-5cdade2ccb2a">

Diff between branches:
<img width="1888" alt="image" src="https://github.com/jesseduffield/lazygit/assets/78085736/81c9041c-1d37-4fe1-9d4c-c268d2dd65ba">

I could help with implementing this, but I don't know where to start. Any help would be appreciated.

<!--
You may be able to add your desired feature with a custom command. Check out the examples here: https://github.com/jesseduffield/lazygit/wiki/Custom-Commands-Compendium

If a custom command does what you want but you still want to see the feature built-in to lazygit, feel free to paste the custom command into the issue to help us better understand the functionality you want.

We also encourage you to put up a PR yourself! Who cares if you've never written Go before, neither did any of the existing contributors before their first lazygit PR! Check out the PR tutorial here: https://www.youtube.com/watch?v=kNavnhzZHtk&ab_channel=JesseDuffield

Also check out the contributing guide here: https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md
-->



Discussion / hints:

Fix patch:
diff --git a/pkg/commands/git_commands/diff.go b/pkg/commands/git_commands/diff.go
index 9f81bb91d53..97927991427 100644
--- a/pkg/commands/git_commands/diff.go
+++ b/pkg/commands/git_commands/diff.go
@@ -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(),


Test patch: