@@ -105,7 +105,11 @@ func doAPICreateCommitStatus(ctx APITestContext, commitID string, status api.Com
105
105
}
106
106
}
107
107
108
- func TestPullCreate_EmptyChangesWithCommits (t * testing.T ) {
108
+ func TestPullCreate_EmptyChangesWithDifferentCommits (t * testing.T ) {
109
+ // Merge must continue if commits SHA are different, even if content is same
110
+ // Reason: gitflow and merging master back into develop, where is high possiblity, there are no changes
111
+ // but just commit saying "Merge branch". And this meta commit can be also tagged,
112
+ // so we need to have this meta commit also in develop branch.
109
113
onGiteaRun (t , func (t * testing.T , u * url.URL ) {
110
114
session := loginUser (t , "user1" )
111
115
testRepoFork (t , session , "user2" , "repo1" , "user1" , "repo1" )
@@ -126,6 +130,28 @@ func TestPullCreate_EmptyChangesWithCommits(t *testing.T) {
126
130
doc := NewHTMLParser (t , resp .Body )
127
131
128
132
text := strings .TrimSpace (doc .doc .Find (".merge-section" ).Text ())
129
- assert .Contains (t , text , "This branch is equal with the target branch." )
133
+ assert .Contains (t , text , "This pull request can be merged automatically." )
134
+ })
135
+ }
136
+
137
+ func TestPullCreate_EmptyChangesWithSameCommits (t * testing.T ) {
138
+ onGiteaRun (t , func (t * testing.T , u * url.URL ) {
139
+ session := loginUser (t , "user1" )
140
+ testRepoFork (t , session , "user2" , "repo1" , "user1" , "repo1" )
141
+ testCreateBranch (t , session , "user1" , "repo1" , "branch/master" , "status1" , http .StatusSeeOther )
142
+ url := path .Join ("user1" , "repo1" , "compare" , "master...status1" )
143
+ req := NewRequestWithValues (t , "POST" , url ,
144
+ map [string ]string {
145
+ "_csrf" : GetCSRF (t , session , url ),
146
+ "title" : "pull request from status1" ,
147
+ },
148
+ )
149
+ session .MakeRequest (t , req , http .StatusSeeOther )
150
+ req = NewRequest (t , "GET" , "/user1/repo1/pulls/1" )
151
+ resp := session .MakeRequest (t , req , http .StatusOK )
152
+ doc := NewHTMLParser (t , resp .Body )
153
+
154
+ text := strings .TrimSpace (doc .doc .Find (".merge-section" ).Text ())
155
+ assert .Contains (t , text , "This branch is already included in the target branch. There is nothing to merge." )
130
156
})
131
157
}
0 commit comments