@@ -53,34 +53,32 @@ public Models.Stash SelectedStash
53
53
if ( value == null )
54
54
{
55
55
Changes = null ;
56
+ _untracked . Clear ( ) ;
56
57
}
57
58
else
58
59
{
59
60
Task . Run ( ( ) =>
60
61
{
61
- var changes = null as List < Models . Change > ;
62
-
63
- if ( Native . OS . GitVersion >= Models . GitVersions . STASH_SHOW_WITH_UNTRACKED )
64
- {
65
- changes = new Commands . QueryStashChanges ( _repo . FullPath , value . Name ) . Result ( ) ;
66
- }
67
- else
62
+ var changes = new Commands . CompareRevisions ( _repo . FullPath , $ "{ value . SHA } ^", value . SHA ) . Result ( ) ;
63
+ var untracked = new List < Models . Change > ( ) ;
64
+
65
+ if ( value . Parents . Count == 3 )
68
66
{
69
- changes = new Commands . CompareRevisions ( _repo . FullPath , $ "{ value . SHA } ^", value . SHA ) . Result ( ) ;
70
- if ( value . Parents . Count == 3 )
71
- {
72
- var untracked = new Commands . CompareRevisions ( _repo . FullPath , Models . Commit . EmptyTreeSHA1 , value . Parents [ 2 ] ) . Result ( ) ;
73
- var needSort = changes . Count > 0 ;
74
-
75
- foreach ( var c in untracked )
76
- changes . Add ( c ) ;
77
-
78
- if ( needSort )
79
- changes . Sort ( ( l , r ) => string . Compare ( l . Path , r . Path , StringComparison . Ordinal ) ) ;
80
- }
67
+ untracked = new Commands . CompareRevisions ( _repo . FullPath , Models . Commit . EmptyTreeSHA1 , value . Parents [ 2 ] ) . Result ( ) ;
68
+ var needSort = changes . Count > 0 && untracked . Count > 0 ;
69
+
70
+ foreach ( var c in untracked )
71
+ changes . Add ( c ) ;
72
+
73
+ if ( needSort )
74
+ changes . Sort ( ( l , r ) => string . Compare ( l . Path , r . Path , StringComparison . Ordinal ) ) ;
81
75
}
82
76
83
- Dispatcher . UIThread . Invoke ( ( ) => Changes = changes ) ;
77
+ Dispatcher . UIThread . Invoke ( ( ) =>
78
+ {
79
+ _untracked = untracked ;
80
+ Changes = changes ;
81
+ } ) ;
84
82
} ) ;
85
83
}
86
84
}
@@ -106,7 +104,7 @@ public Models.Change SelectedChange
106
104
{
107
105
if ( value == null )
108
106
DiffContext = null ;
109
- else if ( value . Index == Models . ChangeState . Added && _selectedStash . Parents . Count == 3 )
107
+ else if ( _untracked . Contains ( value ) )
110
108
DiffContext = new DiffContext ( _repo . FullPath , new Models . DiffOption ( Models . Commit . EmptyTreeSHA1 , _selectedStash . Parents [ 2 ] , value ) , _diffContext ) ;
111
109
else
112
110
DiffContext = new DiffContext ( _repo . FullPath , new Models . DiffOption ( _selectedStash . Parents [ 0 ] , _selectedStash . SHA , value ) , _diffContext ) ;
@@ -129,6 +127,7 @@ public void Dispose()
129
127
{
130
128
_stashes ? . Clear ( ) ;
131
129
_changes ? . Clear ( ) ;
130
+ _untracked . Clear ( ) ;
132
131
133
132
_repo = null ;
134
133
_selectedStash = null ;
@@ -309,6 +308,7 @@ private void RefreshVisible()
309
308
private string _searchFilter = string . Empty ;
310
309
private Models . Stash _selectedStash = null ;
311
310
private List < Models . Change > _changes = null ;
311
+ private List < Models . Change > _untracked = [ ] ;
312
312
private Models . Change _selectedChange = null ;
313
313
private DiffContext _diffContext = null ;
314
314
}
0 commit comments