Skip to content

Exclude metadata/prerelease tags. #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions git/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <bad tag that was found>`
return runCommand(cmd)
Expand Down