Skip to content

Commit fa7c021

Browse files
authored
SCM - fix treeview comparison function (microsoft#203325)
1 parent c75ad1f commit fa7c021

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,28 +1171,16 @@ export class SCMTreeSorter implements ITreeSorter<TreeElement> {
11711171
return 1;
11721172
}
11731173

1174-
if (isSCMViewSeparator(one)) {
1175-
if (!isSCMHistoryItemGroupTreeElement(other) && !isSCMResourceGroup(other)) {
1176-
throw new Error('Invalid comparison');
1177-
}
1178-
1179-
return 0;
1180-
}
1181-
11821174
if (isSCMResourceGroup(one)) {
1183-
if (!isSCMResourceGroup(other)) {
1184-
throw new Error('Invalid comparison');
1185-
}
1175+
return isSCMResourceGroup(other) ? 0 : -1;
1176+
}
11861177

1187-
return 0;
1178+
if (isSCMViewSeparator(one)) {
1179+
return isSCMResourceGroup(other) ? 1 : -1;
11881180
}
11891181

11901182
if (isSCMHistoryItemGroupTreeElement(one)) {
1191-
if (!isSCMHistoryItemGroupTreeElement(other) && !isSCMResourceGroup(other) && !isSCMViewSeparator(other)) {
1192-
throw new Error('Invalid comparison');
1193-
}
1194-
1195-
return 0;
1183+
return isSCMHistoryItemGroupTreeElement(other) ? 0 : 1;
11961184
}
11971185

11981186
if (isSCMHistoryItemTreeElement(one)) {

0 commit comments

Comments
 (0)