diff --git a/CHANGELOG.md b/CHANGELOG.md index 09cd82d19250..bdc0a223e3f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ This changelog goes through all the changes that have been made in each release without substantial changes to our git log; to see the highlights of what has been added to each release, please refer to the [blog](https://blog.gitea.io). +## [1.9.2](https://github.com/go-gitea/gitea/releases/tag/v1.9.2) - 2019-08-22 +* BUGFIXES + * Fix wrong sender when send slack webhook (#7918) (#7924) + * Upload support text/plain; charset=utf8 (#7899) + * Lfs/lock: round locked_at timestamp to second (#7872) (#7875) + * Fix non existent milestone with 500 error (#7867) (#7873) +* SECURITY + * Fix No PGP signature on 1.9.1 tag (#7874) + * Release built with go 1.12.9 to fix security fixes in golang std lib, ref: https://groups.google.com/forum/#!msg/golang-announce/oeMaeUnkvVE/a49yvTLqAAAJ +* ENHANCEMENT + * Fix pull creation with empty changes (#7920) (#7926) +* BUILD + * Drone/docker: prepare multi-arch release + provide arm64 image (#7571) (#7884) + ## [1.9.1](https://github.com/go-gitea/gitea/releases/tag/v1.9.1) - 2019-08-14 * BREAKING * Add pagination for admin api get orgs and fix only list public orgs bug (#7742) (#7752) diff --git a/integrations/pull_status_test.go b/integrations/pull_status_test.go index 2a4d8e0b68fa..fde2d3cc9b38 100644 --- a/integrations/pull_status_test.go +++ b/integrations/pull_status_test.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" "path" + "strings" "testing" "code.gitea.io/gitea/models" @@ -93,3 +94,28 @@ func TestPullCreate_CommitStatus(t *testing.T) { } }) } + +func TestPullCreate_EmptyChangesWithCommits(t *testing.T) { + onGiteaRun(t, func(t *testing.T, u *url.URL) { + session := loginUser(t, "user1") + testRepoFork(t, session, "user2", "repo1", "user1", "repo1") + testEditFileToNewBranch(t, session, "user1", "repo1", "master", "status1", "README.md", "status1") + testEditFileToNewBranch(t, session, "user1", "repo1", "status1", "status1", "README.md", "# repo1\n\nDescription for repo1") + + url := path.Join("user1", "repo1", "compare", "master...status1") + req := NewRequestWithValues(t, "POST", url, + map[string]string{ + "_csrf": GetCSRF(t, session, url), + "title": "pull request from status1", + }, + ) + session.MakeRequest(t, req, http.StatusFound) + + req = NewRequest(t, "GET", "/user1/repo1/pulls/1") + resp := session.MakeRequest(t, req, http.StatusOK) + doc := NewHTMLParser(t, resp.Body) + + text := strings.TrimSpace(doc.doc.Find(".item.text.green").Text()) + assert.EqualValues(t, "This pull request can be merged automatically.", text) + }) +} diff --git a/models/pull.go b/models/pull.go index 7dd6050c6760..3f890881923b 100644 --- a/models/pull.go +++ b/models/pull.go @@ -598,7 +598,7 @@ func (pr *PullRequest) testPatch(e Engine) (err error) { if err != nil { for i := range patchConflicts { if strings.Contains(stderr, patchConflicts[i]) { - log.Trace("PullRequest[%d].testPatch (apply): has conflict", pr.ID) + log.Trace("PullRequest[%d].testPatch (apply): has conflict: %s", pr.ID, stderr) const prefix = "error: patch failed:" pr.Status = PullRequestStatusConflict pr.ConflictedFiles = make([]string, 0, 5) @@ -661,13 +661,16 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str } pr.Index = pull.Index - if err = repo.savePatch(sess, pr.Index, patch); err != nil { - return fmt.Errorf("SavePatch: %v", err) - } - pr.BaseRepo = repo - if err = pr.testPatch(sess); err != nil { - return fmt.Errorf("testPatch: %v", err) + pr.Status = PullRequestStatusChecking + if len(patch) > 0 { + if err = repo.savePatch(sess, pr.Index, patch); err != nil { + return fmt.Errorf("SavePatch: %v", err) + } + + if err = pr.testPatch(sess); err != nil { + return fmt.Errorf("testPatch: %v", err) + } } // No conflict appears after test means mergeable. if pr.Status == PullRequestStatusChecking { diff --git a/models/release.go b/models/release.go index f8e8c17e74cf..a6dfb5c20a04 100644 --- a/models/release.go +++ b/models/release.go @@ -409,7 +409,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachment Action: api.HookReleaseUpdated, Release: rel.APIFormat(), Repository: rel.Repo.APIFormat(mode), - Sender: rel.Publisher.APIFormat(), + Sender: doer.APIFormat(), }); err1 != nil { log.Error("PrepareWebhooks: %v", err) } else { @@ -420,7 +420,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachment } // DeleteReleaseByID deletes a release and corresponding Git tag by given ID. -func DeleteReleaseByID(id int64, u *User, delTag bool) error { +func DeleteReleaseByID(id int64, doer *User, delTag bool) error { rel, err := GetReleaseByID(id) if err != nil { return fmt.Errorf("GetReleaseByID: %v", err) @@ -459,12 +459,12 @@ func DeleteReleaseByID(id int64, u *User, delTag bool) error { return fmt.Errorf("LoadAttributes: %v", err) } - mode, _ := AccessLevel(u, rel.Repo) + mode, _ := AccessLevel(doer, rel.Repo) if err := PrepareWebhooks(rel.Repo, HookEventRelease, &api.ReleasePayload{ Action: api.HookReleaseDeleted, Release: rel.APIFormat(), Repository: rel.Repo.APIFormat(mode), - Sender: rel.Publisher.APIFormat(), + Sender: doer.APIFormat(), }); err != nil { log.Error("PrepareWebhooks: %v", err) } else {