diff --git a/CHANGELOG.md b/CHANGELOG.md index fda6174..ed90470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - Fixes [#314](https://github.com/eamodio/vscode-gitlens/issues/314) - Toggle line annotation doesn't work properly - Fixes [#310](https://github.com/eamodio/vscode-gitlens/issues/310) - "via Terminal" commands need quoting around work directory +- Fixes issues with the active repository in the *GitLens* explorer failed to update properly - Fixes issues with *Open File*, *Open Revision*, *Show File History* commands and images and other binary files ## [8.1.1] - 2018-03-12 diff --git a/src/views/activeRepositoryNode.ts b/src/views/activeRepositoryNode.ts index 46fb1ef..e4f4047 100644 --- a/src/views/activeRepositoryNode.ts +++ b/src/views/activeRepositoryNode.ts @@ -74,7 +74,7 @@ export class ActiveRepositoryNode extends ExplorerNode { this._repositoryNode.dispose(); } - this._repositoryNode = new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this.explorer, true); + this._repositoryNode = new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this.explorer, true, this); } finally { if (changed) { diff --git a/src/views/branchesNode.ts b/src/views/branchesNode.ts index 2a24d7b..5b9462f 100644 --- a/src/views/branchesNode.ts +++ b/src/views/branchesNode.ts @@ -20,6 +20,10 @@ export class BranchesNode extends ExplorerNode { super(uri); } + get id(): string { + return `gitlens:repository(${this.repo.path})${this.active ? ':active' : ''}:branches`; + } + async getChildren(): Promise { const branches = await this.repo.getBranches(); if (branches === undefined) return []; diff --git a/src/views/gitExplorer.ts b/src/views/gitExplorer.ts index e57ba6a..0d6864e 100644 --- a/src/views/gitExplorer.ts +++ b/src/views/gitExplorer.ts @@ -229,7 +229,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider { const remotes = await this.repo.getRemotes(); if (remotes === undefined || remotes.length === 0) return [new MessageNode('No remotes configured')]; diff --git a/src/views/repositoryNode.ts b/src/views/repositoryNode.ts index 3de5c9a..7124bce 100644 --- a/src/views/repositoryNode.ts +++ b/src/views/repositoryNode.ts @@ -18,7 +18,8 @@ export class RepositoryNode extends ExplorerNode { uri: GitUri, readonly repo: Repository, private readonly explorer: GitExplorer, - private readonly active: boolean = false + private readonly active: boolean = false, + private readonly activeParent?: ExplorerNode ) { super(uri); } @@ -34,9 +35,9 @@ export class RepositoryNode extends ExplorerNode { this.children = [ 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), - new TagsNode(this.uri, this.repo, this.explorer) + new RemotesNode(this.uri, this.repo, this.explorer, this.active), + new StashesNode(this.uri, this.repo, this.explorer, this.active), + new TagsNode(this.uri, this.repo, this.explorer, this.active) ]; return this.children; } @@ -76,7 +77,7 @@ export class RepositoryNode extends ExplorerNode { Logger.log(`RepositoryNode.onRepoChanged(${e.changes.join()}); triggering node refresh`); if (this.children === undefined || e.changed(RepositoryChange.Repository) || e.changed(RepositoryChange.Config)) { - this.explorer.refreshNode(this); + this.explorer.refreshNode(this.active && this.activeParent !== undefined ? this.activeParent : this); return; } diff --git a/src/views/stashesNode.ts b/src/views/stashesNode.ts index 38c7c83..3117114 100644 --- a/src/views/stashesNode.ts +++ b/src/views/stashesNode.ts @@ -11,11 +11,16 @@ export class StashesNode extends ExplorerNode { constructor( uri: GitUri, private readonly repo: Repository, - private readonly explorer: Explorer + private readonly explorer: Explorer, + private readonly active: boolean = false ) { super(uri); } + get id(): string { + return `gitlens:repository(${this.repo.path})${this.active ? ':active' : ''}:stashes`; + } + async getChildren(): Promise { const stash = await this.repo.getStashList(); if (stash === undefined) return [new MessageNode('No stashed changes')]; diff --git a/src/views/tagsNode.ts b/src/views/tagsNode.ts index 75507d0..16a3af9 100644 --- a/src/views/tagsNode.ts +++ b/src/views/tagsNode.ts @@ -10,11 +10,16 @@ export class TagsNode extends ExplorerNode { constructor( uri: GitUri, private readonly repo: Repository, - private readonly explorer: Explorer + private readonly explorer: Explorer, + private readonly active: boolean = false ) { super(uri); } + get id(): string { + return `gitlens:repository(${this.repo.path})${this.active ? ':active' : ''}:tags`; + } + async getChildren(): Promise { const tags = await this.repo.getTags(); if (tags.length === 0) return [new MessageNode('No tags yet')];