diff options
author | Martin Hartkorn <github@hartkorn.net> | 2016-02-24 13:56:54 +0100 |
---|---|---|
committer | Martin Hartkorn <github@hartkorn.net> | 2016-02-24 13:56:54 +0100 |
commit | 51f15880d1f25f9d40d93762c5dcb52c2dccac14 (patch) | |
tree | a972324ce0304c499e72edae0c9807ab528da4ea /routers/repo/pull.go | |
parent | d324500959c06e975921790f8770aa5d1bdf2344 (diff) | |
download | gitea-51f15880d1f25f9d40d93762c5dcb52c2dccac14.tar.gz gitea-51f15880d1f25f9d40d93762c5dcb52c2dccac14.zip |
Call PushToBaseRepo() also on Pull Request creation and not only on git push
Diffstat (limited to 'routers/repo/pull.go')
-rw-r--r-- | routers/repo/pull.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go index cf8c4829b4..58acb1758d 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -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) { |