Fall back to sorting by name, if all else is equal.

This commit is contained in:
Bryan Gardiner 2024-09-29 17:07:26 -07:00
parent 02a8e4911a
commit 4ae4ae9fae
No known key found for this signature in database
GPG key ID: 53EFBCA063E6183C

View file

@ -500,7 +500,10 @@ class PackageListEntryCombinedComparator(PackageListEntryComparator):
if result != 0: if result != 0:
return result return result
return 0 # Fall back to applying the default sort, if none of the requested
# comparators have found any difference. Without this, packages may
# appear in nondeterministic order.
return DEFAULT_SORT.cmp_packages(a, b)
def reversed(self) -> PackageListEntryComparator: def reversed(self) -> PackageListEntryComparator:
return PackageListEntryCombinedComparator(c.reversed() for c in self._comparators) return PackageListEntryCombinedComparator(c.reversed() for c in self._comparators)