Skip to content

Commit

Permalink
Revert "fix: getTag return incorrect tag, if we have more than 1 tag …
Browse files Browse the repository at this point in the history
…for 1 commit (#1164)"

This reverts commit 2403a40.
  • Loading branch information
caarlos0 committed Oct 21, 2019
1 parent 5f0ad32 commit 449ed95
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions internal/pipe/git/git.go
Expand Up @@ -74,7 +74,7 @@ func getGitInfo() (context.GitInfo, error) {
return context.GitInfo{}, errors.Wrap(err, "couldn't get remote URL")
}
tag, err := getTag()
if err != nil || tag == "" {
if err != nil {
return context.GitInfo{
Commit: full,
FullCommit: full,
Expand Down Expand Up @@ -122,12 +122,7 @@ func getFullCommit() (string, error) {
}

func getTag() (string, error) {
// Even when version sort is used in git-tag[1], tagnames with the same base version
// but different suffixes are still sorted lexicographically, resulting e.g. in prerelease tags
// appearing after the main release (e.g. "1.0-rc1" after "1.0").
// This variable can be specified to determine the sorting order of tags with different suffixes.
// https://git-scm.com/docs/git-config/2.19.2#git-config-versionsortsuffix
return git.Clean(git.Run("-c", "versionsort.suffix=-", "tag", "-l", "--sort=-v:refname"))
return git.Clean(git.Run("describe", "--tags", "--abbrev=0"))
}

func getURL() (string, error) {
Expand Down

0 comments on commit 449ed95

Please sign in to comment.