Skip to content

Commit

Permalink
DefaultTags() returns non-semver tags as-is.
Browse files Browse the repository at this point in the history
  • Loading branch information
gypapp committed May 15, 2020
1 parent 05c329a commit 7300eb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func DefaultTags(ref string) []string {
v := stripTagPrefix(ref)
version, err := semver.NewVersion(v)
if err != nil {
return []string{"latest"}
return []string{v}
}
if version.PreRelease != "" || version.Metadata != "" {
return []string{
Expand Down
5 changes: 4 additions & 1 deletion tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ func TestDefaultTags(t *testing.T) {
{"refs/tags/v1.0.0", []string{"1", "1.0", "1.0.0"}},
{"refs/tags/v1.0.0-alpha.1", []string{"1.0.0-alpha.1"}},

// not semver tags as-is
{"refs/tags/x1.0.0", []string{"x1.0.0"}},
{"refs/tags/local_test", []string{"local_test"}},

// malformed or errors
{"refs/tags/x1.0.0", []string{"latest"}},
{"v1.0.0", []string{"latest"}},
}

Expand Down

0 comments on commit 7300eb8

Please sign in to comment.