Skip to content

Commit ed42eba

Browse files
committed
Fixes issue with untracked files being counted properly
1 parent 2245d82 commit ed42eba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/views/statusFilesNode.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,13 @@ export class StatusFilesNode extends ExplorerNode {
6161
}
6262

6363
async getTreeItem(): Promise<TreeItem> {
64+
// Start with any untracked files, since they won't be included in the next call
65+
let files = (this.status.files === undefined) ? 0 : this.status.files.filter(s => s.status === '?').length;
66+
6467
const stats = await this.git.getChangedFilesCount(this.status.repoPath, this.git.config.insiders ? this.status.upstream : this.range);
65-
const files = (stats === undefined) ? 0 : stats.files;
68+
if (stats !== undefined) {
69+
files += stats.files;
70+
}
6671

6772
const label = `${files} file${files > 1 ? 's' : ''} changed`; // ${this.status.upstream === undefined ? '' : ` (ahead of ${this.status.upstream})`}`;
6873
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);

0 commit comments

Comments
 (0)