From 74859e8ba30ccdf4bab5f2a8a814c7dfd6b4cf9d Mon Sep 17 00:00:00 2001 From: Alex Beltran Date: Tue, 11 Jun 2019 09:37:37 -0700 Subject: [PATCH 1/2] Exclude metadata/prerelease tags. --- git/tag.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/tag.go b/git/tag.go index dbd6e7c..f2e78fe 100644 --- a/git/tag.go +++ b/git/tag.go @@ -36,8 +36,8 @@ func (g Git) PushTag(t tag.Tag) (err error) { func runGitDescribe() (string, error) { // The following glob(7) pattern is not perfect. It will match things like v1.4badstring.8 - // But it narrows down the results by a good bit - cmd := exec.Command("git", "describe", "--abbrev=0", "--tags", "--match=v[0-9]*\\.[0-9]*\\.[0-9]*") + // But it narrows down the results by a good bit. It will exclude prerelease tags such as `v1.4.8-rc-1` + cmd := exec.Command("git", "describe", "--abbrev=0", "--tags", "--match=v[0-9]*\\.[0-9]*\\.[0-9]*", "--exclude=v[0-9] *\\.[0 - 9]*\\.[0 - 9]*-*") // TODO: if we find a tag, but it's invalid (human created), we should retry and find the one previous. // Probably with a `git describe ` return runCommand(cmd) From ebbe78a59391617c55e126a2047ee75afb0b380b Mon Sep 17 00:00:00 2001 From: Alex Beltran Date: Tue, 11 Jun 2019 10:57:24 -0700 Subject: [PATCH 2/2] Update tag.go Remove whitespace from exclude --- git/tag.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/tag.go b/git/tag.go index f2e78fe..20227c4 100644 --- a/git/tag.go +++ b/git/tag.go @@ -37,7 +37,7 @@ func (g Git) PushTag(t tag.Tag) (err error) { func runGitDescribe() (string, error) { // The following glob(7) pattern is not perfect. It will match things like v1.4badstring.8 // But it narrows down the results by a good bit. It will exclude prerelease tags such as `v1.4.8-rc-1` - cmd := exec.Command("git", "describe", "--abbrev=0", "--tags", "--match=v[0-9]*\\.[0-9]*\\.[0-9]*", "--exclude=v[0-9] *\\.[0 - 9]*\\.[0 - 9]*-*") + cmd := exec.Command("git", "describe", "--abbrev=0", "--tags", "--match=v[0-9]*\\.[0-9]*\\.[0-9]*", "--exclude=v[0-9]*\\.[0-9]*\\.[0-9]*-*") // TODO: if we find a tag, but it's invalid (human created), we should retry and find the one previous. // Probably with a `git describe ` return runCommand(cmd)