go-git: ensure original tag is used for TS lookup

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals 2021-10-22 13:25:24 +02:00
parent 4c94f88ebb
commit 9ff5334688
1 changed files with 2 additions and 2 deletions

View File

@ -212,7 +212,7 @@ func (c *CheckoutSemVer) Checkout(ctx context.Context, path, url string, auth *g
} }
var matchedVersions semver.Collection var matchedVersions semver.Collection
for tag, _ := range tags { for tag := range tags {
v, err := version.ParseVersion(tag) v, err := version.ParseVersion(tag)
if err != nil { if err != nil {
continue continue
@ -239,7 +239,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()