refactor: remove Ctx field from git.Repository (#38500)

This commit is contained in:
wxiaoguang
2026-07-17 18:44:31 +08:00
committed by GitHub
parent 2c8e99bbf7
commit 5b078f72aa
235 changed files with 1234 additions and 1258 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ func SyncRepoBranches(ctx context.Context, repoID, doerID int64) (int64, error)
log.Debug("SyncRepoBranches: in Repo[%d:%s]", repo.ID, repo.FullName())
gitRepo, err := gitrepo.OpenRepository(ctx, repo)
gitRepo, err := gitrepo.OpenRepository(repo)
if err != nil {
log.Error("OpenRepository[%s]: %w", repo.FullName(), err)
return 0, err
@@ -45,7 +45,7 @@ func SyncRepoBranches(ctx context.Context, repoID, doerID int64) (int64, error)
}
func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, doerID int64) (int64, []*SyncResult, error) {
objFmt, err := gitRepo.GetObjectFormat()
objFmt, err := gitRepo.GetObjectFormat(ctx)
if err != nil {
return 0, nil, fmt.Errorf("GetObjectFormat: %w", err)
}
@@ -58,7 +58,7 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
allBranches := container.Set[string]{}
{
branches, _, err := gitRepo.GetBranchNames(0, 0)
branches, _, err := gitRepo.GetBranchNames(ctx, 0, 0)
if err != nil {
return 0, nil, err
}
@@ -88,7 +88,7 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
var syncResults []*SyncResult
for branch := range allBranches {
dbb := dbBranches[branch]
commit, err := gitRepo.GetBranchCommit(branch)
commit, err := gitRepo.GetBranchCommit(ctx, branch)
if err != nil {
return 0, nil, err
}