libgit2: ensure original tag is used for TS lookup
This adds an additional selection candidate, to ensure test flakiness happens more often. Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
parent
b35d7d88f2
commit
4c94f88ebb
|
|
@ -225,7 +225,7 @@ func (c *CheckoutSemVer) Checkout(ctx context.Context, path, url string, auth *g
|
||||||
// versions into a chronological order. This is especially important for
|
// versions into a chronological order. This is especially important for
|
||||||
// versions that differ only by build metadata, because it is not considered
|
// versions that differ only by build metadata, because it is not considered
|
||||||
// a part of the comparable version in Semver
|
// a part of the comparable version in Semver
|
||||||
return tagTimestamps[left.String()].Before(tagTimestamps[right.String()])
|
return tagTimestamps[left.Original()].Before(tagTimestamps[right.Original()])
|
||||||
})
|
})
|
||||||
v := matchedVersions[len(matchedVersions)-1]
|
v := matchedVersions[len(matchedVersions)-1]
|
||||||
t := v.Original()
|
t := v.Original()
|
||||||
|
|
|
||||||
|
|
@ -229,13 +229,19 @@ func TestCheckoutTagSemVer_Checkout(t *testing.T) {
|
||||||
{
|
{
|
||||||
tag: "v0.1.0+build-1",
|
tag: "v0.1.0+build-1",
|
||||||
annotated: true,
|
annotated: true,
|
||||||
commitTime: now.Add(1 * time.Minute),
|
commitTime: now.Add(10 * time.Minute),
|
||||||
tagTime: now.Add(1 * time.Hour), // This should be ignored during TS comparisons
|
tagTime: now.Add(2 * time.Hour), // This should be ignored during TS comparisons
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: "v0.1.0+build-2",
|
tag: "v0.1.0+build-2",
|
||||||
annotated: false,
|
annotated: false,
|
||||||
commitTime: now.Add(2 * time.Minute),
|
commitTime: now.Add(30 * time.Minute),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag: "v0.1.0+build-3",
|
||||||
|
annotated: true,
|
||||||
|
commitTime: now.Add(1 * time.Hour),
|
||||||
|
tagTime: now.Add(1 * time.Hour), // This should be ignored during TS comparisons
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: "0.2.0",
|
tag: "0.2.0",
|
||||||
|
|
@ -258,7 +264,7 @@ func TestCheckoutTagSemVer_Checkout(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "Orders by SemVer and timestamp",
|
name: "Orders by SemVer and timestamp",
|
||||||
constraint: "<0.2.0",
|
constraint: "<0.2.0",
|
||||||
expectTag: "v0.1.0+build-2",
|
expectTag: "v0.1.0+build-3",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Errors without match",
|
name: "Errors without match",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue