diff options
author | 6543 <6543@obermui.de> | 2022-05-03 21:46:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 21:46:28 +0200 |
commit | 92f139d091c906cc6d30599101d45c62a208f585 (patch) | |
tree | e7be0dfc3cd9ae0611bd7cfa11cc1ee277e756fd /modules | |
parent | 730420b6b32414db7fcd12ede87712b0f960de7b (diff) | |
download | gitea-92f139d091c906cc6d30599101d45c62a208f585.tar.gz gitea-92f139d091c906cc6d30599101d45c62a208f585.zip |
Use for a repo action one database transaction (#19576)
... more context
(part of #9307)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/convert/convert.go | 2 | ||||
-rw-r--r-- | modules/git/commit_test.go | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/modules/convert/convert.go b/modules/convert/convert.go index bd06f4dbf4..3a12ed8f1f 100644 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -87,7 +87,7 @@ func ToBranch(repo *repo_model.Repository, b *git.Branch, c *git.Commit, bp *mod return nil, err } branch.UserCanPush = bp.CanUserPush(user.ID) - branch.UserCanMerge = models.IsUserMergeWhitelisted(bp, user.ID, permission) + branch.UserCanMerge = models.IsUserMergeWhitelisted(db.DefaultContext, bp, user.ID, permission) } return branch, nil diff --git a/modules/git/commit_test.go b/modules/git/commit_test.go index aac7de5d46..fb8c22dfd3 100644 --- a/modules/git/commit_test.go +++ b/modules/git/commit_test.go @@ -67,6 +67,7 @@ empty commit` gitRepo, err := openRepositoryWithDefaultContext(filepath.Join(testReposDir, "repo1_bare")) assert.NoError(t, err) assert.NotNil(t, gitRepo) + defer gitRepo.Close() commitFromReader, err := CommitFromReader(gitRepo, sha, strings.NewReader(commitString)) assert.NoError(t, err) @@ -111,6 +112,7 @@ func TestHasPreviousCommit(t *testing.T) { repo, err := openRepositoryWithDefaultContext(bareRepo1Path) assert.NoError(t, err) + defer repo.Close() commit, err := repo.GetCommit("8006ff9adbf0cb94da7dad9e537e53817f9fa5c0") assert.NoError(t, err) |