diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index 562bc927780..336f381c964 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -1171,28 +1171,16 @@ export class SCMTreeSorter implements ITreeSorter { 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)) {