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