diff options
Diffstat (limited to 'modules/git/repo_tag.go')
-rw-r--r-- | modules/git/repo_tag.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/git/repo_tag.go b/modules/git/repo_tag.go index 45a1df70..8f37d31a 100644 --- a/modules/git/repo_tag.go +++ b/modules/git/repo_tag.go @@ -20,12 +20,8 @@ func (repo *Repository) IsTagExist(tagName string) bool { return IsTagExist(repo.Path, tagName) } -// GetTags returns all tags of given repository. -func (repo *Repository) GetTags() ([]string, error) { - if gitVer.AtLeast(MustParseVersion("2.0.0")) { - return repo.getTagsReversed() - } - stdout, stderr, err := com.ExecCmdDir(repo.Path, "git", "tag", "-l") +func (repo *Repository) getTagsReversed() ([]string, error) { + stdout, stderr, err := com.ExecCmdDir(repo.Path, "git", "tag", "-l", "--sort=-v:refname") if err != nil { return nil, concatenateError(err, stderr) } @@ -33,10 +29,14 @@ func (repo *Repository) GetTags() ([]string, error) { return tags[:len(tags)-1], nil } -func (repo *Repository) getTagsReversed() ([]string, error) { - stdout, stderr, err := com.ExecCmdDir(repo.Path, "git", "tag", "-l", "--sort=-v:refname") +// GetTags returns all tags of given repository. +func (repo *Repository) GetTags() ([]string, error) { + if gitVer.AtLeast(MustParseVersion("2.0.0")) { + return repo.getTagsReversed() + } + stdout, stderr, err := com.ExecCmdDir(repo.Path, "git", "tag", "-l") if err != nil { - return nil, errors.New(stderr) + return nil, concatenateError(err, stderr) } tags := strings.Split(stdout, "\n") return tags[:len(tags)-1], nil |