aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/files/patch.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 /services/repository/files/patch.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 'services/repository/files/patch.go')
-rw-r--r--services/repository/files/patch.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/repository/files/patch.go b/services/repository/files/patch.go
index b5eef8c091..33f4b6c9dc 100644
--- a/services/repository/files/patch.go
+++ b/services/repository/files/patch.go
@@ -70,7 +70,7 @@ func (opts *ApplyDiffPatchOptions) Validate(ctx context.Context, repo *repo_mode
if err != nil {
return err
}
- if protectedBranch != nil && !protectedBranch.CanUserPush(doer.ID) {
+ if protectedBranch != nil && !protectedBranch.CanUserPush(ctx, doer.ID) {
return models.ErrUserCannotCommit{
UserName: doer.LowerName,
}