@@ -13,15 +13,16 @@ class Window : BaseWindow
1313 private const string Menu_Window_GitHub = "Window/GitHub" ;
1414 private const string Menu_Window_GitHub_Command_Line = "Window/GitHub Command Line" ;
1515
16- [ NonSerialized ] private bool currentBranchAndRemoteHasUpdate ;
17- [ NonSerialized ] private bool currentTrackingStatusHasUpdate ;
1816 [ NonSerialized ] private double notificationClearTime = - 1 ;
1917 [ NonSerialized ] private double timeSinceLastRotation = - 1f ;
2018 [ NonSerialized ] private Spinner spinner ;
2119 [ NonSerialized ] private IProgress progress ;
2220 [ NonSerialized ] private float progressValue ;
2321 [ NonSerialized ] private string progressMessage ;
2422
23+ [ SerializeField ] private bool currentBranchAndRemoteHasUpdate ;
24+ [ SerializeField ] private bool currentTrackingStatusHasUpdate ;
25+ [ SerializeField ] private bool currentStatusEntriesHasUpdate ;
2526 [ SerializeField ] private SubTab changeTab = SubTab . InitProject ;
2627 [ SerializeField ] private SubTab activeTab = SubTab . InitProject ;
2728 [ SerializeField ] private InitProjectView initProjectView = new InitProjectView ( ) ;
@@ -40,6 +41,7 @@ class Window : BaseWindow
4041 [ SerializeField ] private GUIContent currentRemoteUrlContent ;
4142 [ SerializeField ] private CacheUpdateEvent lastCurrentBranchAndRemoteChangedEvent ;
4243 [ SerializeField ] private CacheUpdateEvent lastTrackingStatusChangedEvent ;
44+ [ SerializeField ] private CacheUpdateEvent lastStatusEntriesChangedEvent ;
4345
4446 [ MenuItem ( Menu_Window_GitHub ) ]
4547 public static void Window_GitHub ( )
@@ -271,13 +273,16 @@ private void MaybeUpdateData()
271273 if ( currentTrackingStatusHasUpdate )
272274 {
273275 currentTrackingStatusHasUpdate = false ;
274-
275276 statusAhead = Repository . CurrentAhead ;
276277 statusBehind = Repository . CurrentBehind ;
278+ }
277279
280+ if ( currentStatusEntriesHasUpdate )
281+ {
282+ currentStatusEntriesHasUpdate = false ;
278283 var currentChanges = Repository . CurrentChanges ;
279- hasItemsToCommit = currentChanges != null
280- && currentChanges . Any ( entry => entry . Status != GitFileStatus . Ignored && ! entry . Staged ) ;
284+ hasItemsToCommit = currentChanges != null &&
285+ currentChanges . Any ( entry => entry . Status != GitFileStatus . Ignored && ! entry . Staged ) ;
281286 }
282287
283288 if ( currentBranchAndRemoteHasUpdate )
@@ -366,6 +371,7 @@ private void AttachHandlers(IRepository repository)
366371 return ;
367372 repository . CurrentBranchAndRemoteChanged += RepositoryOnCurrentBranchAndRemoteChanged ;
368373 repository . TrackingStatusChanged += RepositoryOnTrackingStatusChanged ;
374+ repository . StatusEntriesChanged += RepositoryOnStatusEntriesChanged ;
369375 }
370376
371377 private void RepositoryOnCurrentBranchAndRemoteChanged ( CacheUpdateEvent cacheUpdateEvent )
@@ -388,6 +394,16 @@ private void RepositoryOnTrackingStatusChanged(CacheUpdateEvent cacheUpdateEvent
388394 }
389395 }
390396
397+ private void RepositoryOnStatusEntriesChanged ( CacheUpdateEvent cacheUpdateEvent )
398+ {
399+ if ( ! lastStatusEntriesChangedEvent . Equals ( cacheUpdateEvent ) )
400+ {
401+ lastStatusEntriesChangedEvent = cacheUpdateEvent ;
402+ currentStatusEntriesHasUpdate = true ;
403+ Redraw ( ) ;
404+ }
405+ }
406+
391407 private void OnProgress ( IProgress progr )
392408 {
393409 progress = progr ;
@@ -399,6 +415,7 @@ private void DetachHandlers(IRepository repository)
399415 return ;
400416 repository . CurrentBranchAndRemoteChanged -= RepositoryOnCurrentBranchAndRemoteChanged ;
401417 repository . TrackingStatusChanged -= RepositoryOnTrackingStatusChanged ;
418+ repository . StatusEntriesChanged -= RepositoryOnStatusEntriesChanged ;
402419 }
403420
404421 private void DoHeaderGUI ( )
0 commit comments