Skip to content

Commit 45086c4

Browse files
committed
fix: Fixed invalid comparison result when version component length is differ.
1 parent 758722e commit 45086c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

RelaxVersioner.Core/Version.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ static int Compare(ushort? lhs, ushort? rhs)
9999
return build;
100100
}
101101
var revision = Compare(this.Revision, rhs.Revision);
102-
return revision;
102+
if (revision != 0)
103+
{
104+
return revision;
105+
}
106+
107+
// If numerically equivalent, prefer the version with more components
108+
return this.ComponentCount.CompareTo(rhs.ComponentCount);
103109
}
104110

105111
public int ComponentCount

0 commit comments

Comments
 (0)