| 
8 | 8 | 	"net/http"  | 
9 | 9 | 	"net/url"  | 
10 | 10 | 	"path"  | 
 | 11 | +	"strings"  | 
11 | 12 | 	"testing"  | 
12 | 13 | 
 
  | 
13 | 14 | 	"code.gitea.io/gitea/models"  | 
@@ -93,3 +94,28 @@ func TestPullCreate_CommitStatus(t *testing.T) {  | 
93 | 94 | 		}  | 
94 | 95 | 	})  | 
95 | 96 | }  | 
 | 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 | +}  | 
0 commit comments