@@ -724,6 +724,10 @@ export class Repository implements Disposable {
724724 const progressManager = new ProgressManager ( this ) ;
725725 this . disposables . push ( progressManager ) ;
726726
727+ const onDidChangeCountBadge = filterEvent ( workspace . onDidChangeConfiguration , e => e . affectsConfiguration ( 'git.countBadge' , root ) ) ;
728+ onDidChangeCountBadge ( this . setCountBadge , this , this . disposables ) ;
729+ this . setCountBadge ( ) ;
730+
727731 this . updateCommitTemplate ( ) ;
728732 }
729733
@@ -1495,15 +1499,7 @@ export class Repository implements Disposable {
14951499 this . workingTreeGroup . resourceStates = workingTree ;
14961500
14971501 // set count badge
1498- const countBadge = workspace . getConfiguration ( 'git' ) . get < string > ( 'countBadge' ) ;
1499- let count = merge . length + index . length + workingTree . length ;
1500-
1501- switch ( countBadge ) {
1502- case 'off' : count = 0 ; break ;
1503- case 'tracked' : count = count - workingTree . filter ( r => r . type === Status . UNTRACKED || r . type === Status . IGNORED ) . length ; break ;
1504- }
1505-
1506- this . _sourceControl . count = count ;
1502+ this . setCountBadge ( ) ;
15071503
15081504 // Disable `Discard All Changes` for "fresh" repositories
15091505 // https://github.com/Microsoft/vscode/issues/43066
@@ -1517,6 +1513,18 @@ export class Repository implements Disposable {
15171513 this . _onDidChangeStatus . fire ( ) ;
15181514 }
15191515
1516+ private setCountBadge ( ) : void {
1517+ const countBadge = workspace . getConfiguration ( 'git' ) . get < string > ( 'countBadge' ) ;
1518+ let count = this . mergeGroup . resourceStates . length + this . indexGroup . resourceStates . length + this . workingTreeGroup . resourceStates . length ;
1519+
1520+ switch ( countBadge ) {
1521+ case 'off' : count = 0 ; break ;
1522+ case 'tracked' : count = count - this . workingTreeGroup . resourceStates . filter ( r => r . type === Status . UNTRACKED || r . type === Status . IGNORED ) . length ; break ;
1523+ }
1524+
1525+ this . _sourceControl . count = count ;
1526+ }
1527+
15201528 private async getRebaseCommit ( ) : Promise < Commit | undefined > {
15211529 const rebaseHeadPath = path . join ( this . repository . root , '.git' , 'REBASE_HEAD' ) ;
15221530 const rebaseApplyPath = path . join ( this . repository . root , '.git' , 'rebase-apply' ) ;
0 commit comments