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