Skip to content

Commit e77be8b

Browse files
committed
Fixes id collisions with branches/remotes/tags
1 parent d9e3342 commit e77be8b

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

src/views/nodes/branchOrTagFolderNode.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ export class BranchOrTagFolderNode extends ViewNode {
1616
public readonly folderName: string,
1717
public readonly relativePath: string | undefined,
1818
public readonly root: Arrays.HierarchicalItem<BranchNode | TagNode>,
19+
private readonly _key?: string,
1920
private readonly _expanded: boolean = false
2021
) {
2122
super(GitUri.fromRepoPath(repoPath), view, parent);
2223
}
2324

2425
get id(): string {
25-
return `${this._instanceId}:gitlens:repository(${this.repoPath}):${this.type}-folder(${this.relativePath})`;
26+
return `${this._instanceId}:gitlens:repository(${this.repoPath})${
27+
this._key === undefined ? '' : `:${this._key}`
28+
}:${this.type}-folder(${this.relativePath})`;
2629
}
2730

2831
getChildren(): ViewNode[] {
@@ -45,6 +48,7 @@ export class BranchOrTagFolderNode extends ViewNode {
4548
folder.name,
4649
folder.relativePath,
4750
folder,
51+
this._key,
4852
expanded
4953
)
5054
);

src/views/nodes/branchesNode.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,16 @@ export class BranchesNode extends ViewNode<RepositoriesView> {
4646
this.view.config.files.compact
4747
);
4848

49-
const root = new BranchOrTagFolderNode(this.view, this, 'branch', this.repo.path, '', undefined, hierarchy);
49+
const root = new BranchOrTagFolderNode(
50+
this.view,
51+
this,
52+
'branch',
53+
this.repo.path,
54+
'',
55+
undefined,
56+
hierarchy,
57+
'branches'
58+
);
5059
this._children = await root.getChildren();
5160
}
5261
return this._children;

src/views/nodes/remoteNode.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export class RemoteNode extends ViewNode<RepositoriesView> {
6161
this.repo.path,
6262
'',
6363
undefined,
64-
hierarchy
64+
hierarchy,
65+
`remote(${this.remote.name}`
6566
);
6667
const children = (await root.getChildren()) as (BranchOrTagFolderNode | BranchNode)[];
6768

src/views/nodes/tagsNode.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@ export class TagsNode extends ViewNode<RepositoriesView> {
3434
this.view.config.files.compact
3535
);
3636

37-
const root = new BranchOrTagFolderNode(this.view, this, 'tag', this.repo.path, '', undefined, hierarchy);
37+
const root = new BranchOrTagFolderNode(
38+
this.view,
39+
this,
40+
'tag',
41+
this.repo.path,
42+
'',
43+
undefined,
44+
hierarchy,
45+
'tags'
46+
);
3847
const children = (await root.getChildren()) as (BranchOrTagFolderNode | TagNode)[];
3948
return children;
4049
}

0 commit comments

Comments
 (0)