Browse Source

Fixes id collisions with branches/remotes/tags

main
Eric Amodio 5 years ago
parent
commit
e77be8bf57
4 changed files with 27 additions and 4 deletions
  1. +5
    -1
      src/views/nodes/branchOrTagFolderNode.ts
  2. +10
    -1
      src/views/nodes/branchesNode.ts
  3. +2
    -1
      src/views/nodes/remoteNode.ts
  4. +10
    -1
      src/views/nodes/tagsNode.ts

+ 5
- 1
src/views/nodes/branchOrTagFolderNode.ts View File

@ -16,13 +16,16 @@ export class BranchOrTagFolderNode extends ViewNode {
public readonly folderName: string, public readonly folderName: string,
public readonly relativePath: string | undefined, public readonly relativePath: string | undefined,
public readonly root: Arrays.HierarchicalItem<BranchNode | TagNode>, public readonly root: Arrays.HierarchicalItem<BranchNode | TagNode>,
private readonly _key?: string,
private readonly _expanded: boolean = false private readonly _expanded: boolean = false
) { ) {
super(GitUri.fromRepoPath(repoPath), view, parent); super(GitUri.fromRepoPath(repoPath), view, parent);
} }
get id(): string { get id(): string {
return `${this._instanceId}:gitlens:repository(${this.repoPath}):${this.type}-folder(${this.relativePath})`;
return `${this._instanceId}:gitlens:repository(${this.repoPath})${
this._key === undefined ? '' : `:${this._key}`
}:${this.type}-folder(${this.relativePath})`;
} }
getChildren(): ViewNode[] { getChildren(): ViewNode[] {
@ -45,6 +48,7 @@ export class BranchOrTagFolderNode extends ViewNode {
folder.name, folder.name,
folder.relativePath, folder.relativePath,
folder, folder,
this._key,
expanded expanded
) )
); );

+ 10
- 1
src/views/nodes/branchesNode.ts View File

@ -46,7 +46,16 @@ export class BranchesNode extends ViewNode {
this.view.config.files.compact this.view.config.files.compact
); );
const root = new BranchOrTagFolderNode(this.view, this, 'branch', this.repo.path, '', undefined, hierarchy);
const root = new BranchOrTagFolderNode(
this.view,
this,
'branch',
this.repo.path,
'',
undefined,
hierarchy,
'branches'
);
this._children = await root.getChildren(); this._children = await root.getChildren();
} }
return this._children; return this._children;

+ 2
- 1
src/views/nodes/remoteNode.ts View File

@ -61,7 +61,8 @@ export class RemoteNode extends ViewNode {
this.repo.path, this.repo.path,
'', '',
undefined, undefined,
hierarchy
hierarchy,
`remote(${this.remote.name}`
); );
const children = (await root.getChildren()) as (BranchOrTagFolderNode | BranchNode)[]; const children = (await root.getChildren()) as (BranchOrTagFolderNode | BranchNode)[];

+ 10
- 1
src/views/nodes/tagsNode.ts View File

@ -34,7 +34,16 @@ export class TagsNode extends ViewNode {
this.view.config.files.compact this.view.config.files.compact
); );
const root = new BranchOrTagFolderNode(this.view, this, 'tag', this.repo.path, '', undefined, hierarchy);
const root = new BranchOrTagFolderNode(
this.view,
this,
'tag',
this.repo.path,
'',
undefined,
hierarchy,
'tags'
);
const children = (await root.getChildren()) as (BranchOrTagFolderNode | TagNode)[]; const children = (await root.getChildren()) as (BranchOrTagFolderNode | TagNode)[];
return children; return children;
} }

Loading…
Cancel
Save