@@ -19,7 +19,6 @@ class ChangesetTreeView : Subview
19
19
[ SerializeField ] private List < GitCommitTarget > entryCommitTargets = new List < GitCommitTarget > ( ) ;
20
20
[ SerializeField ] private List < string > foldedTreeEntries = new List < string > ( ) ;
21
21
[ NonSerialized ] private FileTreeNode tree ;
22
- [ NonSerialized ] private Action < FileTreeNode > stateChangeCallback ;
23
22
24
23
public override void OnGUI ( )
25
24
{
@@ -152,15 +151,15 @@ public void UpdateEntries(IList<GitStatusEntry> newEntries)
152
151
153
152
// Build tree structure
154
153
155
- tree = new FileTreeNode ( FileSystemHelpers . FindCommonPath ( entries . Select ( e => e . Path ) ) , stateChangeCallback ) ;
154
+ tree = new FileTreeNode ( FileSystemHelpers . FindCommonPath ( entries . Select ( e => e . Path ) ) ) ;
156
155
tree . RepositoryPath = tree . Path ;
157
156
for ( var index = 0 ; index < entries . Count ; index ++ )
158
157
{
159
158
var entryPath = entries [ index ] . Path . ToNPath ( ) ;
160
159
if ( entryPath . IsChildOf ( tree . Path ) )
161
160
entryPath = entryPath . RelativeTo ( tree . Path . ToNPath ( ) ) ;
162
161
163
- var node = new FileTreeNode ( entryPath , stateChangeCallback ) { Target = entryCommitTargets [ index ] } ;
162
+ var node = new FileTreeNode ( entryPath ) { Target = entryCommitTargets [ index ] } ;
164
163
if ( ! string . IsNullOrEmpty ( entries [ index ] . ProjectPath ) )
165
164
{
166
165
node . Icon = AssetDatabase . GetCachedIcon ( entries [ index ] . ProjectPath ) ;
@@ -208,7 +207,7 @@ private void BuildTree(FileTreeNode parent, FileTreeNode node)
208
207
if ( ! found )
209
208
{
210
209
var p = parent . RepositoryPath . ToNPath ( ) . Combine ( root ) ;
211
- BuildTree ( parent . Add ( new FileTreeNode ( root , stateChangeCallback ) { RepositoryPath = p } ) , node ) ;
210
+ BuildTree ( parent . Add ( new FileTreeNode ( root ) { RepositoryPath = p } ) , node ) ;
212
211
}
213
212
}
214
213
else if ( nodePath . ExtensionWithDot == ".meta" )
@@ -258,25 +257,7 @@ private void TreeNode(FileTreeNode node)
258
257
}
259
258
if ( EditorGUI . EndChangeCheck ( ) )
260
259
{
261
- var filesAdded = new List < string > ( ) ;
262
- var filesRemoved = new List < string > ( ) ;
263
- stateChangeCallback = new Action < FileTreeNode > ( s =>
264
- {
265
- if ( s . State == CommitState . None )
266
- filesRemoved . Add ( s . Path ) ;
267
- else
268
- filesAdded . Add ( s . Path ) ;
269
- } ) ;
270
260
node . State = toggled ? CommitState . All : CommitState . None ;
271
- if ( filesAdded . Count > 0 )
272
- GitClient . Add ( filesAdded ) ;
273
- if ( filesRemoved . Count > 0 )
274
- GitClient . Remove ( filesAdded ) ;
275
- if ( filesAdded . Count > 0 || filesRemoved . Count > 0 )
276
- {
277
- GitClient . Status ( ) ;
278
- }
279
- // we might need to run git status after these calls
280
261
}
281
262
}
282
263
@@ -420,7 +401,6 @@ private enum CommitState
420
401
421
402
private class FileTreeNode
422
403
{
423
- private readonly Action < FileTreeNode > stateChangeCallback ;
424
404
private List < FileTreeNode > children ;
425
405
private string path ;
426
406
private CommitState state ;
@@ -431,15 +411,8 @@ private class FileTreeNode
431
411
public string RepositoryPath ;
432
412
public GitCommitTarget Target { get ; set ; }
433
413
434
- public FileTreeNode ( Action < FileTreeNode > stateChangeCallback )
435
- {
436
- this . stateChangeCallback = stateChangeCallback ;
437
- children = new List < FileTreeNode > ( ) ;
438
- }
439
-
440
- public FileTreeNode ( string path , Action < FileTreeNode > stateChangeCallback )
414
+ public FileTreeNode ( string path )
441
415
{
442
- this . stateChangeCallback = stateChangeCallback ;
443
416
this . path = path ?? "" ;
444
417
Label = this . path ;
445
418
children = new List < FileTreeNode > ( ) ;
@@ -513,7 +486,6 @@ public CommitState State
513
486
}
514
487
515
488
state = value ;
516
- stateChangeCallback . SafeInvoke ( this ) ;
517
489
518
490
if ( children == null )
519
491
{
0 commit comments