From 61ebe59a088af0f758115e63340552f3bbac7c19 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 28 May 2026 10:20:02 +0300 Subject: refactor(version): unify version tag detection across packages (gq) --- internal/release/release.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'internal/release/release.go') diff --git a/internal/release/release.go b/internal/release/release.go index 9ddf563..da2c221 100644 --- a/internal/release/release.go +++ b/internal/release/release.go @@ -8,11 +8,11 @@ import ( "net/http" "os" "os/exec" - "regexp" "sort" "strings" "codeberg.org/snonux/gitsyncer/internal/httpclient" + "codeberg.org/snonux/gitsyncer/internal/version" ) // Tag represents a git tag @@ -117,15 +117,6 @@ func (m *Manager) EnsureCodebergReleasesEnabled(owner, repo string) error { return nil } -// isVersionTag checks if a tag name is a version tag -// Supports formats: vX.Y.Z, vX.Y, vX, X.Y.Z, X.Y, X -func isVersionTag(tag string) bool { - // Pattern matches version tags with optional 'v' prefix - pattern := `^v?\d+(\.\d+)?(\.\d+)?$` - matched, _ := regexp.MatchString(pattern, tag) - return matched -} - // GetLocalTags returns all version tags from the local git repository func (m *Manager) GetLocalTags(repoPath string) ([]string, error) { cmd := exec.Command("git", "-C", repoPath, "tag", "--list") @@ -139,7 +130,7 @@ func (m *Manager) GetLocalTags(repoPath string) ([]string, error) { for _, tag := range tags { tag = strings.TrimSpace(tag) - if tag != "" && isVersionTag(tag) { + if tag != "" && version.IsVersionTag(tag) { versionTags = append(versionTags, tag) } } -- cgit v1.2.3