2019-02-07 12:00:52 +00:00
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
2019-03-27 09:33:00 +00:00
|
|
|
"code.gitea.io/gitea/modules/git"
|
2019-02-07 12:00:52 +00:00
|
|
|
)
|
|
|
|
|
2019-06-08 14:31:11 +00:00
|
|
|
// GetTagsByPath returns repo tags by its path
|
2019-02-07 12:00:52 +00:00
|
|
|
func GetTagsByPath(path string) ([]*git.Tag, error) {
|
|
|
|
gitRepo, err := git.OpenRepository(path)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return gitRepo.GetTagInfos()
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetTags return repo's tags
|
|
|
|
func (repo *Repository) GetTags() ([]*git.Tag, error) {
|
|
|
|
return GetTagsByPath(repo.RepoPath())
|
|
|
|
}
|