@@ -33,12 +33,6 @@ public string FileModeChange
33
33
private set => SetProperty ( ref _fileModeChange , value ) ;
34
34
}
35
35
36
- public bool IsLoading
37
- {
38
- get => _isLoading ;
39
- private set => SetProperty ( ref _isLoading , value ) ;
40
- }
41
-
42
36
public bool IsTextDiff
43
37
{
44
38
get => _isTextDiff ;
@@ -68,6 +62,7 @@ public DiffContext(string repo, Models.DiffOption option, DiffContext previous =
68
62
_content = previous . _content ;
69
63
_unifiedLines = previous . _unifiedLines ;
70
64
_ignoreWhitespace = previous . _ignoreWhitespace ;
65
+ _info = previous . _info ;
71
66
}
72
67
73
68
if ( string . IsNullOrEmpty ( _option . OrgPath ) || _option . OrgPath == "/dev/null" )
@@ -109,7 +104,6 @@ private void LoadDiffContent()
109
104
{
110
105
Content = null ;
111
106
IsTextDiff = false ;
112
- IsLoading = false ;
113
107
return ;
114
108
}
115
109
@@ -119,10 +113,14 @@ private void LoadDiffContent()
119
113
// There is no way to tell a git-diff to use "ALL lines of context",
120
114
// so instead we set a very high number for the "lines of context" parameter.
121
115
var numLines = Preference . Instance . UseFullTextDiff ? 999999999 : _unifiedLines ;
122
-
123
116
var latest = new Commands . Diff ( _repo , _option , numLines , _ignoreWhitespace ) . Result ( ) ;
124
- var rs = null as object ;
117
+ var info = new Info ( _option , numLines , _ignoreWhitespace , latest ) ;
118
+ if ( _info != null && info . IsSame ( _info ) )
119
+ return ;
120
+
121
+ _info = info ;
125
122
123
+ var rs = null as object ;
126
124
if ( latest . TextDiff != null )
127
125
{
128
126
var count = latest . TextDiff . Lines . Count ;
@@ -219,7 +217,6 @@ private void LoadDiffContent()
219
217
FileModeChange = latest . FileModeChange ;
220
218
Content = rs ;
221
219
IsTextDiff = rs is Models . TextDiff ;
222
- IsLoading = false ;
223
220
} ) ;
224
221
} ) ;
225
222
}
@@ -252,14 +249,41 @@ private Models.RevisionSubmodule QuerySubmoduleRevision(string repo, string sha)
252
249
".ico" , ".bmp" , ".jpg" , ".png" , ".jpeg" , ".webp"
253
250
} ;
254
251
252
+ private class Info
253
+ {
254
+ public string Argument { get ; set ; }
255
+ public int UnifiedLines { get ; set ; }
256
+ public bool IgnoreWhitespace { get ; set ; }
257
+ public string OldHash { get ; set ; }
258
+ public string NewHash { get ; set ; }
259
+
260
+ public Info ( Models . DiffOption option , int unifiedLines , bool ignoreWhitespace , Models . DiffResult result )
261
+ {
262
+ Argument = option . ToString ( ) ;
263
+ UnifiedLines = unifiedLines ;
264
+ IgnoreWhitespace = ignoreWhitespace ;
265
+ OldHash = result . OldHash ;
266
+ NewHash = result . NewHash ;
267
+ }
268
+
269
+ public bool IsSame ( Info other )
270
+ {
271
+ return Argument . Equals ( other . Argument , StringComparison . Ordinal ) &&
272
+ UnifiedLines == other . UnifiedLines &&
273
+ IgnoreWhitespace == other . IgnoreWhitespace &&
274
+ OldHash . Equals ( other . OldHash , StringComparison . Ordinal ) &&
275
+ NewHash . Equals ( other . NewHash , StringComparison . Ordinal ) ;
276
+ }
277
+ }
278
+
255
279
private readonly string _repo ;
256
280
private readonly Models . DiffOption _option = null ;
257
281
private string _title ;
258
282
private string _fileModeChange = string . Empty ;
259
283
private int _unifiedLines = 4 ;
260
- private bool _isLoading = true ;
261
284
private bool _isTextDiff = false ;
262
285
private bool _ignoreWhitespace = false ;
263
286
private object _content = null ;
287
+ private Info _info = null ;
264
288
}
265
289
}
0 commit comments