From 966f02619ca86a23971af5602fa138b22810f146 Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Sat, 5 Apr 2014 00:56:47 -0300 Subject: [PATCH] Peel-off annotated tags. --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9cb1045..131ee87 100644 --- a/main.go +++ b/main.go @@ -288,8 +288,12 @@ func hackedRefs(repo *Repo) (data []byte, versions []Version, err error) { } if strings.HasPrefix(name, "refs/heads/v") || strings.HasPrefix(name, "refs/tags/v") { + if strings.HasSuffix(name, "^{}") { + // Annotated tag is peeled off and overrides the same version just parsed. + name = name[:len(name)-3] + } v, ok := parseVersion(name[strings.IndexByte(name, 'v'):]) - if ok && repo.MajorVersion.Contains(v) && (!vrefv.IsValid() || vrefv.Less(v)) { + if ok && repo.MajorVersion.Contains(v) && (v == vrefv || !vrefv.IsValid() || vrefv.Less(v)) { vrefv = v vrefi = hashi vrefj = hashj