@@ -19,7 +19,6 @@ class ChangesetTreeView : Subview
1919 [ SerializeField ] private List < GitCommitTarget > entryCommitTargets = new List < GitCommitTarget > ( ) ;
2020 [ SerializeField ] private List < string > foldedTreeEntries = new List < string > ( ) ;
2121 [ NonSerialized ] private FileTreeNode tree ;
22- [ NonSerialized ] private Action < FileTreeNode > stateChangeCallback ;
2322
2423 public override void OnGUI ( )
2524 {
@@ -152,15 +151,15 @@ public void UpdateEntries(IList<GitStatusEntry> newEntries)
152151
153152 // Build tree structure
154153
155- tree = new FileTreeNode ( FileSystemHelpers . FindCommonPath ( entries . Select ( e => e . Path ) ) , stateChangeCallback ) ;
154+ tree = new FileTreeNode ( FileSystemHelpers . FindCommonPath ( entries . Select ( e => e . Path ) ) ) ;
156155 tree . RepositoryPath = tree . Path ;
157156 for ( var index = 0 ; index < entries . Count ; index ++ )
158157 {
159158 var entryPath = entries [ index ] . Path . ToNPath ( ) ;
160159 if ( entryPath . IsChildOf ( tree . Path ) )
161160 entryPath = entryPath . RelativeTo ( tree . Path . ToNPath ( ) ) ;
162161
163- var node = new FileTreeNode ( entryPath , stateChangeCallback ) { Target = entryCommitTargets [ index ] } ;
162+ var node = new FileTreeNode ( entryPath ) { Target = entryCommitTargets [ index ] } ;
164163 if ( ! string . IsNullOrEmpty ( entries [ index ] . ProjectPath ) )
165164 {
166165 node . Icon = AssetDatabase . GetCachedIcon ( entries [ index ] . ProjectPath ) ;
@@ -208,7 +207,7 @@ private void BuildTree(FileTreeNode parent, FileTreeNode node)
208207 if ( ! found )
209208 {
210209 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 ) ;
212211 }
213212 }
214213 else if ( nodePath . ExtensionWithDot == ".meta" )
@@ -258,25 +257,7 @@ private void TreeNode(FileTreeNode node)
258257 }
259258 if ( EditorGUI . EndChangeCheck ( ) )
260259 {
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- } ) ;
270260 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
280261 }
281262 }
282263
@@ -420,7 +401,6 @@ private enum CommitState
420401
421402 private class FileTreeNode
422403 {
423- private readonly Action < FileTreeNode > stateChangeCallback ;
424404 private List < FileTreeNode > children ;
425405 private string path ;
426406 private CommitState state ;
@@ -431,15 +411,8 @@ private class FileTreeNode
431411 public string RepositoryPath ;
432412 public GitCommitTarget Target { get ; set ; }
433413
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 )
441415 {
442- this . stateChangeCallback = stateChangeCallback ;
443416 this . path = path ?? "" ;
444417 Label = this . path ;
445418 children = new List < FileTreeNode > ( ) ;
@@ -513,7 +486,6 @@ public CommitState State
513486 }
514487
515488 state = value ;
516- stateChangeCallback . SafeInvoke ( this ) ;
517489
518490 if ( children == null )
519491 {
0 commit comments