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
@@ -87,7 +87,7 @@ func List(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("actions.actions")
ctx.Data["PageIsActions"] = true
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx, ctx.Repo.Repository.DefaultBranch)
if errors.Is(err, util.ErrNotExist) {
ctx.Data["NotFoundPrompt"] = ctx.Tr("repo.branch.default_branch_not_exist", ctx.Repo.Repository.DefaultBranch)
ctx.NotFound(nil)
@@ -181,9 +181,9 @@ func WorkflowDispatchInputs(ctx *context.Context) {
var commit *git.Commit
var err error
if refName.IsTag() {
commit, err = ctx.Repo.GitRepo.GetTagCommit(refName.TagName())
commit, err = ctx.Repo.GitRepo.GetTagCommit(ctx, refName.TagName())
} else if refName.IsBranch() {
commit, err = ctx.Repo.GitRepo.GetBranchCommit(refName.BranchName())
commit, err = ctx.Repo.GitRepo.GetBranchCommit(ctx, refName.BranchName())
} else {
ctx.ServerError("UnsupportedRefType", nil)
return
@@ -215,7 +215,7 @@ func prepareWorkflowTemplate(ctx *context.Context, commit *git.Commit) (workflow
workflows = make([]WorkflowInfo, 0, len(entries))
for _, entry := range entries {
workflow := WorkflowInfo{EntryName: entry.Name()}
content, err := actions.GetContentFromEntry(ctx.Repo.GitRepo, entry)
content, err := actions.GetContentFromEntry(ctx, ctx.Repo.GitRepo, entry)
if err != nil {
ctx.ServerError("GetContentFromEntry", err)
return nil, ""
+3 -3
View File
@@ -251,7 +251,7 @@ func ViewWorkflowFile(ctx *context_module.Context) {
return
}
commit, err := ctx.Repo.GitRepo.GetCommit(run.CommitSHA)
commit, err := ctx.Repo.GitRepo.GetCommit(ctx, run.CommitSHA)
if err != nil {
ctx.NotFoundOrServerError("GetCommit", func(err error) bool {
return errors.Is(err, util.ErrNotExist)
@@ -1476,14 +1476,14 @@ func viewScopedWorkflowFile(ctx *context_module.Context, run *actions_model.Acti
return
}
sourceGitRepo, err := gitrepo.OpenRepository(ctx, sourceRepo)
sourceGitRepo, err := gitrepo.OpenRepository(sourceRepo)
if err != nil {
ctx.ServerError("OpenRepository", err)
return
}
defer sourceGitRepo.Close()
commit, err := sourceGitRepo.GetCommit(run.WorkflowCommitSHA)
commit, err := sourceGitRepo.GetCommit(ctx, run.WorkflowCommitSHA)
if err != nil {
ctx.NotFoundOrServerError("GetCommit", func(err error) bool {
return errors.Is(err, util.ErrNotExist)