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