Skip to content

Commit

Permalink
fix: correct tag prefix check.
Browse files Browse the repository at this point in the history
  • Loading branch information
outofcoffee committed Dec 30, 2023
1 parent 30175bf commit 20a9728
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vcs/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ func getEndTag(repoPath string, endType endTagType, orderBy TagOrderBy) (string,
var candidateTag *plumbing.Reference
var candidateCommit *object.Commit
err = tags.ForEach(func(t *plumbing.Reference) error {
logrus.Tracef("checking tag %s", t.Name().Short())

commit, err := r.CommitObject(t.Hash())
if err != nil {
logrus.Tracef("failed to get commit object for tag %s: %v", t.Name().Short(), err)
Expand Down Expand Up @@ -141,11 +143,11 @@ func getEndTag(repoPath string, endType endTagType, orderBy TagOrderBy) (string,

func compareSemantically(v *plumbing.Reference, w *plumbing.Reference) int {
a := v.Name().Short()
if !strings.HasPrefix("v", a) {
if !strings.HasPrefix(a, "v") {
a = "v" + a
}
b := w.Name().Short()
if !strings.HasPrefix("v", b) {
if !strings.HasPrefix(b, "v") {
b = "v" + b
}
return semver.Compare(a, b)
Expand Down

0 comments on commit 20a9728

Please sign in to comment.