forked from forgejo/forgejo
Move repofiles from modules/repofiles to services/repository/files (#17774)
* Move repofiles from modules to services * rename services/repository/repofiles -> services/repository/files * Fix test Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
754fdd8f9c
commit
c97d66d23c
37 changed files with 277 additions and 353 deletions
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2020 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 repository
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
)
|
||||
|
||||
// GetBranch returns a branch by its name
|
||||
func GetBranch(repo *models.Repository, branch string) (*git.Branch, error) {
|
||||
if len(branch) == 0 {
|
||||
return nil, fmt.Errorf("GetBranch: empty string for branch")
|
||||
}
|
||||
gitRepo, err := git.OpenRepository(repo.RepoPath())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer gitRepo.Close()
|
||||
|
||||
return gitRepo.GetBranch(branch)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue