From 7372042441804370ddcdf00c5ea29acedef99e1d Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 9 Aug 2015 22:45:38 +0800 Subject: list view: issue, label, milestone --- modules/git/repo_tag.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/git') 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 -- cgit v1.2.3