aboutsummaryrefslogtreecommitdiff
path: root/modules/git
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-10 00:37:42 +0800
committerUnknwon <u@gogs.io>2015-08-10 00:37:42 +0800
commita79586cc545594d8876438e2497c9408945748b2 (patch)
tree689da38141f2e3dc2b33a15132f5eb3116915b00 /modules/git
parent590c464c56c993c461f10470926a96448f4f7d00 (diff)
parent8a3ee795d2d069bbb57b3d134367078c8e8391d5 (diff)
Merge branch 'develop' of github.com:gogits/gogs into feature/pull_request2
# Conflicts: # modules/bindata/bindata.go # public/css/gogs.min.css # templates/repo/header.tmpl
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo_tag.go18
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