From ed42eba8b8576b4a77f5a893cf2a4fa5a5f5a25b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 21 Sep 2017 18:43:12 -0400 Subject: [PATCH] Fixes issue with untracked files being counted properly --- src/views/statusFilesNode.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/views/statusFilesNode.ts b/src/views/statusFilesNode.ts index a665801..6a7d627 100644 --- a/src/views/statusFilesNode.ts +++ b/src/views/statusFilesNode.ts @@ -61,8 +61,13 @@ export class StatusFilesNode extends ExplorerNode { } async getTreeItem(): Promise { + // Start with any untracked files, since they won't be included in the next call + let files = (this.status.files === undefined) ? 0 : this.status.files.filter(s => s.status === '?').length; + const stats = await this.git.getChangedFilesCount(this.status.repoPath, this.git.config.insiders ? this.status.upstream : this.range); - const files = (stats === undefined) ? 0 : stats.files; + if (stats !== undefined) { + files += stats.files; + } const label = `${files} file${files > 1 ? 's' : ''} changed`; // ${this.status.upstream === undefined ? '' : ` (ahead of ${this.status.upstream})`}`; const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);