diff options
author | zeripath <art27@cantab.net> | 2019-12-13 22:21:06 +0000 |
---|---|---|
committer | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-12-13 23:21:06 +0100 |
commit | 74179d1b5e739b3fa0d0915bb35d6b7596fd13af (patch) | |
tree | fd8eb776c254b716a4e2d416bb6903f1c4c90ea7 /services/pull/pull.go | |
parent | 8f16a2c37b4f2650f5e9623a92eb368db9564c6f (diff) | |
download | gitea-74179d1b5e739b3fa0d0915bb35d6b7596fd13af.tar.gz gitea-74179d1b5e739b3fa0d0915bb35d6b7596fd13af.zip |
Remove SavePatch and generate patches on the fly (#9302)
* Save patches to temporary files
* Remove SavePatch and generate patches on the fly
* Use ioutil.TempDir
* fixup! Use ioutil.TempDir
* fixup! fixup! Use ioutil.TempDir
* RemoveAll LocalCopyPath() in initIntergrationTest
* Default to status checking on PR creation
* Remove unnecessary set to StatusChecking
* Protect against unable to load repo
* Handle conflicts
* Restore original conflict setting
* In TestPullRequests update status to StatusChecking before running TestPatch
Diffstat (limited to 'services/pull/pull.go')
-rw-r--r-- | services/pull/pull.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go index 2650dacc11..df44402ad8 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -15,8 +15,12 @@ import ( ) // NewPullRequest creates new pull request with labels for repository. -func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, patch []byte, assigneeIDs []int64) error { - if err := models.NewPullRequest(repo, pull, labelIDs, uuids, pr, patch); err != nil { +func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, assigneeIDs []int64) error { + if err := TestPatch(pr); err != nil { + return err + } + + if err := models.NewPullRequest(repo, pull, labelIDs, uuids, pr); err != nil { return err } @@ -56,10 +60,7 @@ func checkForInvalidation(requests models.PullRequestList, repoID int64, doer *m func addHeadRepoTasks(prs []*models.PullRequest) { for _, pr := range prs { log.Trace("addHeadRepoTasks[%d]: composing new test task", pr.ID) - if err := pr.UpdatePatch(); err != nil { - log.Error("UpdatePatch: %v", err) - continue - } else if err := pr.PushToBaseRepo(); err != nil { + if err := pr.PushToBaseRepo(); err != nil { log.Error("PushToBaseRepo: %v", err) continue } |