2019-02-07 05:00:52 -07: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 02:33:00 -07:00
|
|
|
"code.gitea.io/gitea/modules/git"
|
2019-02-07 05:00:52 -07:00
|
|
|
)
|
|
|
|
|
2019-06-08 07:31:11 -07:00
|
|
|
// GetTagsByPath returns repo tags by its path
|
2019-02-07 05:00:52 -07: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())
|
|
|
|
}
|