Eric Amodio 7 years ago
parent
commit
5805c7f7e8
2 changed files with 3 additions and 23 deletions
  1. +1
    -1
      src/views/repositoryNode.ts
  2. +2
    -22
      src/views/statusNode.ts

+ 1
- 1
src/views/repositoryNode.ts View File

@ -27,7 +27,7 @@ export class RepositoryNode extends ExplorerNode {
this.updateSubscription();
this.children = [
new StatusNode(this.uri, this.repo, this, this.explorer, this.active),
new StatusNode(this.uri, this.repo, this.explorer, this.active),
new BranchesNode(this.uri, this.repo, this.explorer, this.active),
new RemotesNode(this.uri, this.repo, this.explorer),
new StashesNode(this.uri, this.repo, this.explorer)

+ 2
- 22
src/views/statusNode.ts View File

@ -1,8 +1,7 @@
import { Disposable, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { GitExplorer } from './gitExplorer';
import { GitStatus, GitUri, Repository, RepositoryFileSystemChangeEvent } from '../gitService';
import { Logger } from '../logger';
import { GitUri, Repository, RepositoryFileSystemChangeEvent } from '../gitService';
import { StatusFilesNode } from './statusFilesNode';
import { StatusUpstreamNode } from './statusUpstreamNode';
@ -11,7 +10,6 @@ export class StatusNode extends ExplorerNode {
constructor(
uri: GitUri,
private readonly repo: Repository,
private readonly parent: ExplorerNode,
private readonly explorer: GitExplorer,
private readonly active: boolean = false
) {
@ -44,8 +42,6 @@ export class StatusNode extends ExplorerNode {
return this.children;
}
private _status: GitStatus | undefined;
async getTreeItem(): Promise < TreeItem > {
if (this.disposable !== undefined) {
this.disposable.dispose();
@ -56,8 +52,6 @@ export class StatusNode extends ExplorerNode {
if (status === undefined) return new TreeItem('No repo status');
if (this.explorer.autoRefresh && this.includeWorkingTree) {
this._status = status;
this.disposable = Disposable.from(
this.explorer.onDidChangeAutoRefresh(this.onAutoRefreshChanged, this),
this.repo.onDidChangeFileSystem(this.onFileSystemChanged, this),
@ -128,20 +122,6 @@ export class StatusNode extends ExplorerNode {
}
private async onFileSystemChanged(e: RepositoryFileSystemChangeEvent) {
const status = await this.repo.getStatus();
// If we haven't changed from having some working changes to none or vice versa then just refresh the node
// This is because of https://github.com/Microsoft/vscode/issues/34789
if (this._status !== undefined && status !== undefined &&
((this._status.files.length === status.files.length) || (this._status.files.length > 0 && status.files.length > 0))) {
Logger.log(`StatusNode.onFileSystemChanged; triggering node refresh`);
this.explorer.refreshNode(this);
return;
}
Logger.log(`StatusNode.onFileSystemChanged; triggering parent node refresh`);
this.explorer.refreshNode(this.parent);
this.explorer.refreshNode(this);
}
}

Loading…
Cancel
Save