SCM - fix treeview comparison function (#203325)

This commit is contained in:
Ladislau Szomoru 2024-01-24 12:54:39 +01:00 committed by GitHub
parent c75ad1fd11
commit fa7c021a82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1171,28 +1171,16 @@ export class SCMTreeSorter implements ITreeSorter<TreeElement> {
return 1;
}
if (isSCMViewSeparator(one)) {
if (!isSCMHistoryItemGroupTreeElement(other) && !isSCMResourceGroup(other)) {
throw new Error('Invalid comparison');
}
return 0;
if (isSCMResourceGroup(one)) {
return isSCMResourceGroup(other) ? 0 : -1;
}
if (isSCMResourceGroup(one)) {
if (!isSCMResourceGroup(other)) {
throw new Error('Invalid comparison');
}
return 0;
if (isSCMViewSeparator(one)) {
return isSCMResourceGroup(other) ? 1 : -1;
}
if (isSCMHistoryItemGroupTreeElement(one)) {
if (!isSCMHistoryItemGroupTreeElement(other) && !isSCMResourceGroup(other) && !isSCMViewSeparator(other)) {
throw new Error('Invalid comparison');
}
return 0;
return isSCMHistoryItemGroupTreeElement(other) ? 0 : 1;
}
if (isSCMHistoryItemTreeElement(one)) {