@@ -34,7 +34,6 @@ import (
34
34
35
35
// Merge merges pull request to base repository.
36
36
// Caller should check PR is ready to be merged (review and status checks)
37
- // FIXME: add repoWorkingPull make sure two merges does not happen at same time.
38
37
func Merge (pr * models.PullRequest , doer * user_model.User , baseGitRepo * git.Repository , mergeStyle repo_model.MergeStyle , expectedHeadCommitID , message string ) error {
39
38
if err := pr .LoadHeadRepo (); err != nil {
40
39
log .Error ("LoadHeadRepo: %v" , err )
@@ -44,6 +43,9 @@ func Merge(pr *models.PullRequest, doer *user_model.User, baseGitRepo *git.Repos
44
43
return fmt .Errorf ("LoadBaseRepo: %v" , err )
45
44
}
46
45
46
+ pullWorkingPool .CheckIn (fmt .Sprint (pr .ID ))
47
+ defer pullWorkingPool .CheckOut (fmt .Sprint (pr .ID ))
48
+
47
49
prUnit , err := pr .BaseRepo .GetUnit (unit .TypePullRequests )
48
50
if err != nil {
49
51
log .Error ("pr.BaseRepo.GetUnit(unit.TypePullRequests): %v" , err )
@@ -726,6 +728,9 @@ func CheckPullBranchProtections(ctx context.Context, pr *models.PullRequest, ski
726
728
727
729
// MergedManually mark pr as merged manually
728
730
func MergedManually (pr * models.PullRequest , doer * user_model.User , baseGitRepo * git.Repository , commitID string ) error {
731
+ pullWorkingPool .CheckIn (fmt .Sprint (pr .ID ))
732
+ defer pullWorkingPool .CheckOut (fmt .Sprint (pr .ID ))
733
+
729
734
if err := db .WithTx (func (ctx context.Context ) error {
730
735
prUnit , err := pr .BaseRepo .GetUnitCtx (ctx , unit .TypePullRequests )
731
736
if err != nil {
0 commit comments