Browse Source

Fixes issue with active repo not updating

main
Eric Amodio 6 years ago
parent
commit
38b81f6d30
8 changed files with 31 additions and 10 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -1
      src/views/activeRepositoryNode.ts
  3. +4
    -0
      src/views/branchesNode.ts
  4. +1
    -1
      src/views/gitExplorer.ts
  5. +6
    -1
      src/views/remotesNode.ts
  6. +6
    -5
      src/views/repositoryNode.ts
  7. +6
    -1
      src/views/stashesNode.ts
  8. +6
    -1
      src/views/tagsNode.ts

+ 1
- 0
CHANGELOG.md View File

@ -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

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

@ -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) {

+ 4
- 0
src/views/branchesNode.ts View File

@ -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<ExplorerNode[]> {
const branches = await this.repo.getBranches();
if (branches === undefined) return [];

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

@ -229,7 +229,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
}
refreshNode(node: ExplorerNode, args?: RefreshNodeCommandArgs) {
Logger.log(`GitExplorer[view=${this._view}].refreshNode`);
Logger.log(`GitExplorer[view=${this._view}].refreshNode(${(node as any).id})`);
if (args !== undefined && node.supportsPaging) {
node.maxCount = args.maxCount;

+ 6
- 1
src/views/remotesNode.ts View File

@ -12,11 +12,16 @@ export class RemotesNode extends ExplorerNode {
constructor(
uri: GitUri,
private readonly repo: Repository,
private readonly explorer: GitExplorer
private readonly explorer: GitExplorer,
private readonly active: boolean = false
) {
super(uri);
}
get id(): string {
return `gitlens:repository(${this.repo.path})${this.active ? ':active' : ''}:remotes`;
}
async getChildren(): Promise<ExplorerNode[]> {
const remotes = await this.repo.getRemotes();
if (remotes === undefined || remotes.length === 0) return [new MessageNode('No remotes configured')];

+ 6
- 5
src/views/repositoryNode.ts View File

@ -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;
}

+ 6
- 1
src/views/stashesNode.ts View File

@ -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<ExplorerNode[]> {
const stash = await this.repo.getStashList();
if (stash === undefined) return [new MessageNode('No stashed changes')];

+ 6
- 1
src/views/tagsNode.ts View File

@ -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<ExplorerNode[]> {
const tags = await this.repo.getTags();
if (tags.length === 0) return [new MessageNode('No tags yet')];

Loading…
Cancel
Save