@@ -32,6 +32,8 @@ define(function (require, exports) {
3232 currentEditor ,
3333 $dropdown ;
3434
35+ let lastRenderedBranchName = null ;
36+
3537 function renderList ( branches ) {
3638 branches = branches . map ( function ( name ) {
3739 return {
@@ -451,10 +453,9 @@ define(function (require, exports) {
451453 return ;
452454 }
453455
454- var branchInHead = m [ 1 ] ,
455- branchInUi = $gitBranchName . text ( ) ;
456+ const branchInHead = m [ 1 ] ;
456457
457- if ( branchInHead !== branchInUi ) {
458+ if ( branchInHead !== lastRenderedBranchName ) {
458459 refresh ( ) ;
459460 }
460461 } ) ;
@@ -480,6 +481,7 @@ define(function (require, exports) {
480481 Preferences . set ( "currentGitRoot" , projectRoot ) ;
481482 Preferences . set ( "currentGitSubfolder" , "" ) ;
482483
484+ lastRenderedBranchName = null ;
483485 $gitBranchName
484486 . off ( "click" )
485487 . text ( Strings . GIT_NOT_A_REPO ) ;
@@ -518,6 +520,7 @@ define(function (require, exports) {
518520
519521 const MAX_LEN = 18 ;
520522
523+ lastRenderedBranchName = branchName ;
521524 const tooltip = StringUtils . format ( Strings . ON_BRANCH , branchName ) ;
522525 const displayName = branchName . length > MAX_LEN
523526 ? branchName . substring ( 0 , MAX_LEN ) + "\u2026"
@@ -543,6 +546,7 @@ define(function (require, exports) {
543546
544547 } ) . catch ( function ( ex ) {
545548 if ( ErrorHandler . contains ( ex , "unknown revision" ) ) {
549+ lastRenderedBranchName = null ;
546550 $gitBranchName
547551 . off ( "click" )
548552 . text ( Strings . GIT_NO_BRANCH ) ;
0 commit comments