mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-30 08:03:52 +03:00
Call PushToBaseRepo() also on Pull Request creation and not only on git push
This commit is contained in:
parent
d324500959
commit
51f15880d1
1 changed files with 13 additions and 6 deletions
|
@ -623,7 +623,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
|
|||
return
|
||||
}
|
||||
|
||||
pull := &models.Issue{
|
||||
pullIssue := &models.Issue{
|
||||
RepoID: repo.ID,
|
||||
Index: repo.NextIssueIndex(),
|
||||
Name: form.Title,
|
||||
|
@ -634,26 +634,33 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
|
|||
IsPull: true,
|
||||
Content: form.Content,
|
||||
}
|
||||
if err := models.NewPullRequest(repo, pull, labelIDs, attachments, &models.PullRequest{
|
||||
pullRequest := &models.PullRequest{
|
||||
HeadRepoID: headRepo.ID,
|
||||
BaseRepoID: repo.ID,
|
||||
HeadUserName: headUser.Name,
|
||||
HeadBranch: headBranch,
|
||||
BaseBranch: baseBranch,
|
||||
HeadRepo: headRepo,
|
||||
BaseRepo: repo,
|
||||
MergeBase: prInfo.MergeBase,
|
||||
Type: models.PULL_REQUEST_GOGS,
|
||||
}, patch); err != nil {
|
||||
}
|
||||
if err := models.NewPullRequest(repo, pullIssue, labelIDs, attachments, pullRequest, patch); err != nil {
|
||||
ctx.Handle(500, "NewPullRequest", err)
|
||||
return
|
||||
}
|
||||
if err := pullRequest.PushToBaseRepo(); err != nil {
|
||||
ctx.Handle(500, "PushToBaseRepo", err)
|
||||
return
|
||||
}
|
||||
|
||||
notifyWatchersAndMentions(ctx, pull)
|
||||
notifyWatchersAndMentions(ctx, pullIssue)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
||||
log.Trace("Pull request created: %d/%d", repo.ID, pull.ID)
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pull.Index))
|
||||
log.Trace("Pull request created: %d/%d", repo.ID, pullIssue.ID)
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pullIssue.Index))
|
||||
}
|
||||
|
||||
func TriggerTask(ctx *middleware.Context) {
|
||||
|
|
Loading…
Reference in a new issue