Skip to content

Commit 24b10ab

Browse files
committed
Merge tag 'v1.9.2' into wild/v1.9
* BUGFIXES * Fix wrong sender when send slack webhook (go-gitea#7918) (go-gitea#7924) * Upload support text/plain; charset=utf8 (go-gitea#7899) * Lfs/lock: round locked_at timestamp to second (go-gitea#7872) (go-gitea#7875) * Fix non existent milestone with 500 error (go-gitea#7867) (go-gitea#7873) * SECURITY * Fix No PGP signature on 1.9.1 tag (go-gitea#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 (go-gitea#7920) (go-gitea#7926) * BUILD * Drone/docker: prepare multi-arch release + provide arm64 image (go-gitea#7571) (go-gitea#7884)
2 parents 1dabb1e + 30dbddc commit 24b10ab

File tree

4 files changed

+54
-11
lines changed

4 files changed

+54
-11
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.9.2](https://github.com/go-gitea/gitea/releases/tag/v1.9.2) - 2019-08-22
8+
* BUGFIXES
9+
* Fix wrong sender when send slack webhook (#7918) (#7924)
10+
* Upload support text/plain; charset=utf8 (#7899)
11+
* Lfs/lock: round locked_at timestamp to second (#7872) (#7875)
12+
* Fix non existent milestone with 500 error (#7867) (#7873)
13+
* SECURITY
14+
* Fix No PGP signature on 1.9.1 tag (#7874)
15+
* 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
16+
* ENHANCEMENT
17+
* Fix pull creation with empty changes (#7920) (#7926)
18+
* BUILD
19+
* Drone/docker: prepare multi-arch release + provide arm64 image (#7571) (#7884)
20+
721
## [1.9.1](https://github.com/go-gitea/gitea/releases/tag/v1.9.1) - 2019-08-14
822
* BREAKING
923
* Add pagination for admin api get orgs and fix only list public orgs bug (#7742) (#7752)

integrations/pull_status_test.go

+26
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"net/url"
1010
"path"
11+
"strings"
1112
"testing"
1213

1314
"code.gitea.io/gitea/models"
@@ -93,3 +94,28 @@ func TestPullCreate_CommitStatus(t *testing.T) {
9394
}
9495
})
9596
}
97+
98+
func TestPullCreate_EmptyChangesWithCommits(t *testing.T) {
99+
onGiteaRun(t, func(t *testing.T, u *url.URL) {
100+
session := loginUser(t, "user1")
101+
testRepoFork(t, session, "user2", "repo1", "user1", "repo1")
102+
testEditFileToNewBranch(t, session, "user1", "repo1", "master", "status1", "README.md", "status1")
103+
testEditFileToNewBranch(t, session, "user1", "repo1", "status1", "status1", "README.md", "# repo1\n\nDescription for repo1")
104+
105+
url := path.Join("user1", "repo1", "compare", "master...status1")
106+
req := NewRequestWithValues(t, "POST", url,
107+
map[string]string{
108+
"_csrf": GetCSRF(t, session, url),
109+
"title": "pull request from status1",
110+
},
111+
)
112+
session.MakeRequest(t, req, http.StatusFound)
113+
114+
req = NewRequest(t, "GET", "/user1/repo1/pulls/1")
115+
resp := session.MakeRequest(t, req, http.StatusOK)
116+
doc := NewHTMLParser(t, resp.Body)
117+
118+
text := strings.TrimSpace(doc.doc.Find(".item.text.green").Text())
119+
assert.EqualValues(t, "This pull request can be merged automatically.", text)
120+
})
121+
}

models/pull.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ func (pr *PullRequest) testPatch(e Engine) (err error) {
598598
if err != nil {
599599
for i := range patchConflicts {
600600
if strings.Contains(stderr, patchConflicts[i]) {
601-
log.Trace("PullRequest[%d].testPatch (apply): has conflict", pr.ID)
601+
log.Trace("PullRequest[%d].testPatch (apply): has conflict: %s", pr.ID, stderr)
602602
const prefix = "error: patch failed:"
603603
pr.Status = PullRequestStatusConflict
604604
pr.ConflictedFiles = make([]string, 0, 5)
@@ -661,13 +661,16 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str
661661
}
662662

663663
pr.Index = pull.Index
664-
if err = repo.savePatch(sess, pr.Index, patch); err != nil {
665-
return fmt.Errorf("SavePatch: %v", err)
666-
}
667-
668664
pr.BaseRepo = repo
669-
if err = pr.testPatch(sess); err != nil {
670-
return fmt.Errorf("testPatch: %v", err)
665+
pr.Status = PullRequestStatusChecking
666+
if len(patch) > 0 {
667+
if err = repo.savePatch(sess, pr.Index, patch); err != nil {
668+
return fmt.Errorf("SavePatch: %v", err)
669+
}
670+
671+
if err = pr.testPatch(sess); err != nil {
672+
return fmt.Errorf("testPatch: %v", err)
673+
}
671674
}
672675
// No conflict appears after test means mergeable.
673676
if pr.Status == PullRequestStatusChecking {

models/release.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachment
409409
Action: api.HookReleaseUpdated,
410410
Release: rel.APIFormat(),
411411
Repository: rel.Repo.APIFormat(mode),
412-
Sender: rel.Publisher.APIFormat(),
412+
Sender: doer.APIFormat(),
413413
}); err1 != nil {
414414
log.Error("PrepareWebhooks: %v", err)
415415
} else {
@@ -420,7 +420,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachment
420420
}
421421

422422
// DeleteReleaseByID deletes a release and corresponding Git tag by given ID.
423-
func DeleteReleaseByID(id int64, u *User, delTag bool) error {
423+
func DeleteReleaseByID(id int64, doer *User, delTag bool) error {
424424
rel, err := GetReleaseByID(id)
425425
if err != nil {
426426
return fmt.Errorf("GetReleaseByID: %v", err)
@@ -459,12 +459,12 @@ func DeleteReleaseByID(id int64, u *User, delTag bool) error {
459459
return fmt.Errorf("LoadAttributes: %v", err)
460460
}
461461

462-
mode, _ := AccessLevel(u, rel.Repo)
462+
mode, _ := AccessLevel(doer, rel.Repo)
463463
if err := PrepareWebhooks(rel.Repo, HookEventRelease, &api.ReleasePayload{
464464
Action: api.HookReleaseDeleted,
465465
Release: rel.APIFormat(),
466466
Repository: rel.Repo.APIFormat(mode),
467-
Sender: rel.Publisher.APIFormat(),
467+
Sender: doer.APIFormat(),
468468
}); err != nil {
469469
log.Error("PrepareWebhooks: %v", err)
470470
} else {

0 commit comments

Comments
 (0)