diff --git a/git/tag.go b/git/tag.go index dbd6e7c..20227c4 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)