summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/branch.go
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2023-01-09 11:50:54 +0800
committerGitHub <noreply@github.com>2023-01-09 11:50:54 +0800
commit7adc2de46404e32ed33f999d308ed56232cdfea5 (patch)
tree2404a22b5fa8a941eb5bfd16fd717fab29d899e4 /routers/web/repo/branch.go
parentb878155b8741c2769b6aa50a80609c36822451c9 (diff)
downloadgitea-7adc2de46404e32ed33f999d308ed56232cdfea5.tar.gz
gitea-7adc2de46404e32ed33f999d308ed56232cdfea5.zip
Use context parameter in models/git (#22367)
After #22362, we can feel free to use transactions without `db.DefaultContext`. And there are still lots of models using `db.DefaultContext`, I think we should refactor them carefully and one by one. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/web/repo/branch.go')
-rw-r--r--routers/web/repo/branch.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go
index 18bb06ed1a..8b48d3fb00 100644
--- a/routers/web/repo/branch.go
+++ b/routers/web/repo/branch.go
@@ -120,7 +120,7 @@ func RestoreBranchPost(ctx *context.Context) {
branchID := ctx.FormInt64("branch_id")
branchName := ctx.FormString("name")
- deletedBranch, err := git_model.GetDeletedBranchByID(ctx.Repo.Repository.ID, branchID)
+ deletedBranch, err := git_model.GetDeletedBranchByID(ctx, ctx.Repo.Repository.ID, branchID)
if err != nil {
log.Error("GetDeletedBranchByID: %v", err)
ctx.Flash.Error(ctx.Tr("repo.branch.restore_failed", branchName))
@@ -189,7 +189,7 @@ func loadBranches(ctx *context.Context, skip, limit int) (*Branch, []*Branch, in
return nil, nil, 0
}
- protectedBranches, err := git_model.GetProtectedBranches(ctx.Repo.Repository.ID)
+ protectedBranches, err := git_model.GetProtectedBranches(ctx, ctx.Repo.Repository.ID)
if err != nil {
ctx.ServerError("GetProtectedBranches", err)
return nil, nil, 0
@@ -331,7 +331,7 @@ func loadOneBranch(ctx *context.Context, rawBranch, defaultBranch *git.Branch, p
func getDeletedBranches(ctx *context.Context) ([]*Branch, error) {
branches := []*Branch{}
- deletedBranches, err := git_model.GetDeletedBranches(ctx.Repo.Repository.ID)
+ deletedBranches, err := git_model.GetDeletedBranches(ctx, ctx.Repo.Repository.ID)
if err != nil {
return branches, err
}