Git: fix assert when comparing GerritApproval

When compiling a debug msvc build std::stable_sort verifies that the
compare function returns the inverted result when switching the left
hand side with the right hand side argument.

Change-Id: I34549d69144966c1b74f368e9af35ec565dc791e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
David Schulz
2020-11-16 11:29:17 +01:00
parent 92667c779c
commit 1984ebcf51

View File

@@ -67,7 +67,8 @@ QDebug operator<<(QDebug d, const GerritApproval &a)
// Sort approvals by type and reviewer
bool gerritApprovalLessThan(const GerritApproval &a1, const GerritApproval &a2)
{
return a1.type.compare(a2.type) < 0 || a1.reviewer.fullName.compare(a2.reviewer.fullName) < 0;
const int compare = a1.type.compare(a2.type);
return compare == 0 ? a1.reviewer.fullName.compare(a2.reviewer.fullName) < 0 : compare < 0;
}
QDebug operator<<(QDebug d, const GerritPatchSet &p)