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
@@ -142,7 +142,7 @@ func ApplyDiffPatch(ctx context.Context, repo *repo_model.Repository, doer *user
}
// Get the commit of the original branch
commit, err := t.GetBranchCommit(opts.OldBranch)
commit, err := t.GetBranchCommit(ctx, opts.OldBranch)
if err != nil {
return nil, err // Couldn't get a commit for the branch
}
@@ -151,7 +151,7 @@ func ApplyDiffPatch(ctx context.Context, repo *repo_model.Repository, doer *user
if opts.LastCommitID == "" {
opts.LastCommitID = commit.ID.String()
} else {
lastCommitID, err := t.gitRepo.ConvertToGitID(opts.LastCommitID)
lastCommitID, err := t.gitRepo.ConvertToGitID(ctx, opts.LastCommitID)
if err != nil {
return nil, fmt.Errorf("ApplyPatch: Invalid last commit ID: %w", err)
}
@@ -206,12 +206,12 @@ func ApplyDiffPatch(ctx context.Context, repo *repo_model.Repository, doer *user
return nil, err
}
commit, err = t.GetCommit(commitHash)
commit, err = t.GetCommit(ctx, commitHash)
if err != nil {
return nil, err
}
fileCommitResponse, _ := GetFileCommitResponse(repo, gitRepo, commit) // ok if fails, then will be nil
fileCommitResponse, _ := GetFileCommitResponse(ctx, repo, gitRepo, commit) // ok if fails, then will be nil
verification := GetPayloadCommitVerification(ctx, commit)
fileResponse := &structs.FileResponse{
Commit: fileCommitResponse,