mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-23 21:23:41 +09:00
refactor: remove Ctx field from git.Repository (#38500)
This commit is contained in:
@@ -15,23 +15,23 @@ import (
|
||||
// GetBranchesByPath returns a branch by its path
|
||||
// if limit = 0 it will not limit
|
||||
func GetBranchesByPath(ctx context.Context, repo Repository, skip, limit int) ([]string, int, error) {
|
||||
gitRepo, err := OpenRepository(ctx, repo)
|
||||
gitRepo, err := OpenRepository(repo)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
defer gitRepo.Close()
|
||||
|
||||
return gitRepo.GetBranchNames(skip, limit)
|
||||
return gitRepo.GetBranchNames(ctx, skip, limit)
|
||||
}
|
||||
|
||||
func GetBranchCommitID(ctx context.Context, repo Repository, branch string) (string, error) {
|
||||
gitRepo, err := OpenRepository(ctx, repo)
|
||||
gitRepo, err := OpenRepository(repo)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer gitRepo.Close()
|
||||
|
||||
return gitRepo.GetBranchCommitID(branch)
|
||||
return gitRepo.GetBranchCommitID(ctx, branch)
|
||||
}
|
||||
|
||||
// SetDefaultBranch sets default branch of repository.
|
||||
|
||||
Reference in New Issue
Block a user