@@ -179,15 +179,21 @@ export class StatsTreeProvider implements vscode.TreeDataProvider<StatsNode> {
179179 return [ new StatsNode ( 'info' , 'No Git history available' , vscode . TreeItemCollapsibleState . None ) ] ;
180180 }
181181
182- const totalChanges = result . stats . reduce ( ( sum , s ) => sum + ( s . added + s . deleted ) , 0 ) ;
182+ // Only include contributors with at least one change
183+ const effectiveStats = result . stats . filter ( s => ( s . added + s . deleted ) > 0 ) ;
184+ if ( effectiveStats . length === 0 ) {
185+ return [ new StatsNode ( 'info' , 'No contributors with changes found' , vscode . TreeItemCollapsibleState . None ) ] ;
186+ }
187+
188+ const totalChanges = effectiveStats . reduce ( ( sum , s ) => sum + ( s . added + s . deleted ) , 0 ) ;
183189 const totalNode = new StatsNode (
184190 'info' ,
185- `Total contributors: ${ result . stats . length } ` ,
191+ `Total contributors: ${ effectiveStats . length } ` ,
186192 vscode . TreeItemCollapsibleState . None
187193 ) ;
188194 totalNode . description = `${ totalChanges . toLocaleString ( ) } total changes` ;
189195
190- return [ totalNode , ...result . stats . map ( ( entry ) => {
196+ return [ totalNode , ...effectiveStats . map ( ( entry ) => {
191197 const entryTotal = entry . added + entry . deleted ;
192198 const percent = totalChanges > 0 ? Math . round ( ( entryTotal / totalChanges ) * 100 ) : 0 ;
193199 const description = `${ entryTotal . toLocaleString ( ) } changes (${ percent } %)` ;
@@ -207,15 +213,21 @@ export class StatsTreeProvider implements vscode.TreeDataProvider<StatsNode> {
207213 return [ new StatsNode ( 'info' , 'No Git history available' , vscode . TreeItemCollapsibleState . None ) ] ;
208214 }
209215
210- const totalChanges = result . stats . reduce ( ( sum , s ) => sum + ( s . added + s . deleted ) , 0 ) ;
216+ // Only include contributors with recorded changes across repository history
217+ const effectiveStats = result . stats . filter ( s => ( s . added + s . deleted ) > 0 ) ;
218+ if ( effectiveStats . length === 0 ) {
219+ return [ new StatsNode ( 'info' , 'No contributors with changes found' , vscode . TreeItemCollapsibleState . None ) ] ;
220+ }
221+
222+ const totalChanges = effectiveStats . reduce ( ( sum , s ) => sum + ( s . added + s . deleted ) , 0 ) ;
211223 const totalNode = new StatsNode (
212224 'info' ,
213- `Total contributors (all): ${ result . stats . length } ` ,
225+ `Total contributors (all): ${ effectiveStats . length } ` ,
214226 vscode . TreeItemCollapsibleState . None
215227 ) ;
216228 totalNode . description = `${ totalChanges . toLocaleString ( ) } total changes (repository)` ;
217229
218- return [ totalNode , ...result . stats . map ( ( entry ) => {
230+ return [ totalNode , ...effectiveStats . map ( ( entry ) => {
219231 const entryTotal = entry . added + entry . deleted ;
220232 const percent = totalChanges > 0 ? Math . round ( ( entryTotal / totalChanges ) * 100 ) : 0 ;
221233 const description = `${ entryTotal . toLocaleString ( ) } changes (${ percent } %)` ;
0 commit comments