Fix comment and bug

This commit is contained in:
Lunny Xiao 2024-05-03 23:19:28 +08:00
parent 0e306f76da
commit 860121db9f
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 1 additions and 5 deletions

View File

@ -327,7 +327,7 @@ func loadContextCacheUser(ctx context.Context, id int64) (*user_model.User, erro
})
}
// handlePullRequestMerging handle pull request merging, a pull request action should only push 1 commit
// handlePullRequestMerging handle pull request merging, a pull request action should push at least 1 commit
func handlePullRequestMerging(ctx *gitea_context.PrivateContext, opts *private.HookOptions, ownerName, repoName string, updates []*repo_module.PushUpdateOptions) {
if len(updates) == 0 {
ctx.JSON(http.StatusInternalServerError, private.HookPostReceiveResult{
@ -335,10 +335,6 @@ func handlePullRequestMerging(ctx *gitea_context.PrivateContext, opts *private.H
})
return
}
if len(updates) != 1 && !setting.IsProd {
// it shouldn't happen
panic(fmt.Sprintf("Pushing a merged PR (pr:%d) should only push 1 commit, but got %d", opts.PullRequestID, len(updates)))
}
pr, err := issues_model.GetPullRequestByID(ctx, opts.PullRequestID)
if err != nil {