@@ -35,7 +35,7 @@ public interface IRepositoryManager : IDisposable
3535 ITask UnlockFile ( string file , bool force ) ;
3636 void UpdateGitLog ( ) ;
3737 void UpdateGitStatus ( ) ;
38- void UpdateGitAheadBehindStatus ( string gitRef , string otherRef ) ;
38+ void UpdateGitAheadBehindStatus ( ) ;
3939 void UpdateLocks ( ) ;
4040 int WaitForEvents ( ) ;
4141
@@ -284,17 +284,27 @@ public void UpdateGitStatus()
284284 } ) . Start ( ) ;
285285 }
286286
287- public void UpdateGitAheadBehindStatus ( string gitRef , string otherRef )
287+ public void UpdateGitAheadBehindStatus ( )
288288 {
289- var task = GitClient . AheadBehindStatus ( gitRef , otherRef ) ;
290- task = HookupHandlers ( task , true , false ) ;
291- task . Then ( ( success , status ) =>
289+ ConfigBranch ? configBranch ;
290+ ConfigRemote ? configRemote ;
291+ GetCurrentBranchAndRemote ( out configBranch , out configRemote ) ;
292+
293+ if ( configBranch . HasValue && configBranch . Value . Remote . HasValue )
292294 {
293- if ( success )
295+ var name = configBranch . Value . Name ;
296+ var trackingName = configBranch . Value . IsTracking ? configBranch . Value . Remote . Value . Name + "/" + name : "[None]" ;
297+
298+ var task = GitClient . AheadBehindStatus ( name , trackingName ) ;
299+ task = HookupHandlers ( task , true , false ) ;
300+ task . Then ( ( success , status ) =>
294301 {
295- GitAheadBehindStatusUpdated ? . Invoke ( status ) ;
296- }
297- } ) . Start ( ) ;
302+ if ( success )
303+ {
304+ GitAheadBehindStatusUpdated ? . Invoke ( status ) ;
305+ }
306+ } ) . Start ( ) ;
307+ }
298308 }
299309
300310 public void UpdateLocks ( )
@@ -437,6 +447,7 @@ private void WatcherOnRepositoryCommitted()
437447 {
438448 Logger . Trace ( "WatcherOnRepositoryCommitted" ) ;
439449 UpdateGitLog ( ) ;
450+ UpdateGitAheadBehindStatus ( ) ;
440451 }
441452
442453 private void WatcherOnRepositoryChanged ( )
@@ -536,17 +547,7 @@ private void UpdateRemoteBranches()
536547 Logger . Trace ( "OnRemoteBranchListUpdated {0} remotes" , remotes . Count ) ;
537548 RemoteBranchesUpdated ? . Invoke ( remotes , remoteBranches ) ;
538549
539- ConfigBranch ? configBranch ;
540- ConfigRemote ? configRemote ;
541- GetCurrentBranchAndRemote ( out configBranch , out configRemote ) ;
542-
543- if ( configBranch . HasValue && configBranch . Value . Remote . HasValue )
544- {
545- var name = configBranch . Value . Name ;
546- var trackingName = configBranch . Value . IsTracking ? configBranch . Value . Remote . Value . Name + "/" + name : "[None]" ;
547-
548- UpdateGitAheadBehindStatus ( name , trackingName ) ;
549- }
550+ UpdateGitAheadBehindStatus ( ) ;
550551 }
551552
552553 private bool disposed ;
0 commit comments