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