@@ -477,6 +477,11 @@ define(function (require, exports) {
477477 function refresh ( ) {
478478 if ( $gitBranchName . length === 0 ) { return ; }
479479
480+ const projectRoot = Utils . getProjectRoot ( ) ;
481+ function isStale ( ) {
482+ return Utils . getProjectRoot ( ) !== projectRoot ;
483+ }
484+
480485 // show info that branch is refreshing currently
481486 $gitBranchName
482487 . text ( "\u2026" )
@@ -485,8 +490,8 @@ define(function (require, exports) {
485490 Panel . setBranchName ( "\u2026" , "" ) ;
486491
487492 return Git . getGitRoot ( ) . then ( function ( gitRoot ) {
488- var projectRoot = Utils . getProjectRoot ( ) ,
489- isRepositoryRootOrChild = gitRoot && projectRoot . indexOf ( gitRoot ) === 0 ;
493+ if ( isStale ( ) ) { return ; }
494+ var isRepositoryRootOrChild = gitRoot && projectRoot . indexOf ( gitRoot ) === 0 ;
490495
491496 $gitBranchName . parent ( ) . toggle ( isRepositoryRootOrChild ) ;
492497
@@ -514,6 +519,7 @@ define(function (require, exports) {
514519 return Git . getCurrentBranchName ( ) . then ( function ( branchName ) {
515520
516521 Git . getMergeInfo ( ) . then ( function ( mergeInfo ) {
522+ if ( isStale ( ) ) { return ; }
517523
518524 if ( mergeInfo . mergeMode ) {
519525 branchName += "|MERGING" ;
@@ -558,6 +564,7 @@ define(function (require, exports) {
558564 } ) ;
559565
560566 } ) . catch ( function ( ex ) {
567+ if ( isStale ( ) ) { return ; }
561568 if ( ErrorHandler . contains ( ex , "unknown revision" ) ) {
562569 lastRenderedBranchName = null ;
563570 $gitBranchName
0 commit comments