mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-14 12:08:33 -05:00
Adds gitlens.gitExplorer.includeWorkingTree setting
Adds auto-update for working trree Fixes issues with working tree status
This commit is contained in:
@@ -38,7 +38,7 @@ export class StatusFilesNode extends ExplorerNode {
|
||||
statuses = [];
|
||||
}
|
||||
|
||||
if (this.status.files.length !== 0 && this.git.config.insiders) {
|
||||
if (this.status.files.length !== 0 && this.includeWorkingTree) {
|
||||
statuses.splice(0, 0, ...this.status.files.map(s => {
|
||||
return { ...s, commit: new GitLogCommit('file', this.status.repoPath, GitService.uncommittedSha, s.fileName, 'You', new Date(), '', s.status, [s], s.originalFileName, 'HEAD', s.fileName) } as IGitStatusFileWithCommit;
|
||||
}));
|
||||
@@ -61,12 +61,13 @@ export class StatusFilesNode extends ExplorerNode {
|
||||
}
|
||||
|
||||
async getTreeItem(): Promise<TreeItem> {
|
||||
// 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;
|
||||
let files = (this.status.files !== undefined && this.includeWorkingTree) ? this.status.files.length : 0;
|
||||
|
||||
const stats = await this.git.getChangedFilesCount(this.status.repoPath, this.git.config.insiders ? this.status.upstream : this.range);
|
||||
if (stats !== undefined) {
|
||||
files += stats.files;
|
||||
if (this.status.upstream !== undefined) {
|
||||
const stats = await this.git.getChangedFilesCount(this.status.repoPath, `${this.status.upstream}...`);
|
||||
if (stats !== undefined) {
|
||||
files += stats.files;
|
||||
}
|
||||
}
|
||||
|
||||
const label = `${files} file${files > 1 ? 's' : ''} changed`; // ${this.status.upstream === undefined ? '' : ` (ahead of ${this.status.upstream})`}`;
|
||||
@@ -79,4 +80,9 @@ export class StatusFilesNode extends ExplorerNode {
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private get includeWorkingTree(): boolean {
|
||||
return this.git.config.gitExplorer.includeWorkingTree;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user