mirror of https://github.com/go-gitea/gitea
Backport #8901 - Adjusted slightly for 1.9 In investigating #7947 it has become clear that the storage component of go-git repositories needs closing. This PR adds this Close function and adds the Close functions as necessary. In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files. Fixes #7947pull/8967/head
parent
2ef37522b6
commit
fb5af37b3e
@ -1,24 +0,0 @@ |
||||
// 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 ( |
||||
"code.gitea.io/gitea/modules/git" |
||||
) |
||||
|
||||
// GetTagsByPath returns repo tags by its path
|
||||
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()) |
||||
} |
Loading…
Reference in new issue