@@ -103,6 +103,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
103103 contextSize uint64
104104 similarityThreshold int
105105 ignoreWhitespace bool
106+ extDiffCmd string
106107 expected []string
107108 }
108109
@@ -113,31 +114,40 @@ func TestStashStashEntryCmdObj(t *testing.T) {
113114 contextSize : 3 ,
114115 similarityThreshold : 50 ,
115116 ignoreWhitespace : false ,
116- expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--color=always" , "--unified=3" , "--find-renames=50%" , "refs/stash@{5}" },
117+ expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--no-ext-diff" , "-- color=always" , "--unified=3" , "--find-renames=50%" , "refs/stash@{5}" },
117118 },
118119 {
119120 testName : "Show diff with custom context size" ,
120121 index : 5 ,
121122 contextSize : 77 ,
122123 similarityThreshold : 50 ,
123124 ignoreWhitespace : false ,
124- expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--color=always" , "--unified=77" , "--find-renames=50%" , "refs/stash@{5}" },
125+ expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--no-ext-diff" , "-- color=always" , "--unified=77" , "--find-renames=50%" , "refs/stash@{5}" },
125126 },
126127 {
127128 testName : "Show diff with custom similarity threshold" ,
128129 index : 5 ,
129130 contextSize : 3 ,
130131 similarityThreshold : 33 ,
131132 ignoreWhitespace : false ,
132- expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--color=always" , "--unified=3" , "--find-renames=33%" , "refs/stash@{5}" },
133+ expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--no-ext-diff" , "--color=always" , "--unified=3" , "--find-renames=33%" , "refs/stash@{5}" },
134+ },
135+ {
136+ testName : "Show diff with external diff command" ,
137+ index : 5 ,
138+ contextSize : 3 ,
139+ similarityThreshold : 50 ,
140+ ignoreWhitespace : false ,
141+ extDiffCmd : "difft --color=always" ,
142+ expected : []string {"git" , "-C" , "/path/to/worktree" , "-c" , "diff.external=difft --color=always" , "stash" , "show" , "-p" , "--stat" , "-u" , "--ext-diff" , "--color=always" , "--unified=3" , "--find-renames=50%" , "refs/stash@{5}" },
133143 },
134144 {
135145 testName : "Default case" ,
136146 index : 5 ,
137147 contextSize : 3 ,
138148 similarityThreshold : 50 ,
139149 ignoreWhitespace : true ,
140- expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--color=always" , "--unified=3" , "--ignore-all-space" , "--find-renames=50%" , "refs/stash@{5}" },
150+ expected : []string {"git" , "-C" , "/path/to/worktree" , "stash" , "show" , "-p" , "--stat" , "-u" , "--no-ext-diff" , "-- color=always" , "--unified=3" , "--ignore-all-space" , "--find-renames=50%" , "refs/stash@{5}" },
141151 },
142152 }
143153
@@ -147,6 +157,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
147157 userConfig .Git .IgnoreWhitespaceInDiffView = s .ignoreWhitespace
148158 userConfig .Git .DiffContextSize = s .contextSize
149159 userConfig .Git .RenameSimilarityThreshold = s .similarityThreshold
160+ userConfig .Git .Paging .ExternalDiffCommand = s .extDiffCmd
150161 repoPaths := RepoPaths {
151162 worktreePath : "/path/to/worktree" ,
152163 }
0 commit comments