@@ -240,6 +240,34 @@ func TestPullSquash(t *testing.T) {
240240 })
241241}
242242
243+ func TestPullSquashMergeEmpty (t * testing.T ) {
244+ onGiteaRun (t , func (t * testing.T , u * url.URL ) {
245+ session := loginUser (t , "user1" )
246+ testEditFileToNewBranch (t , session , "user2" , "repo1" , "master" , "pr-squash-empty" , "README.md" , "Hello, World (Edited)\n " )
247+ resp := testPullCreate (t , session , "user2" , "repo1" , false , "master" , "pr-squash-empty" , "This is a pull title" )
248+
249+ elem := strings .Split (test .RedirectURL (resp ), "/" )
250+ assert .Equal (t , "pulls" , elem [3 ])
251+
252+ httpContext := NewAPITestContext (t , "user2" , "repo1" , auth_model .AccessTokenScopeWriteRepository )
253+ dstPath := t .TempDir ()
254+
255+ u .Path = httpContext .GitPath ()
256+ u .User = url .UserPassword ("user2" , userPassword )
257+
258+ t .Run ("Clone" , doGitClone (dstPath , u ))
259+ doGitCheckoutBranch (dstPath , "-b" , "pr-squash-empty" , "remotes/origin/pr-squash-empty" )(t )
260+ doGitMerge (dstPath , "pr-squash-empty" )(t )
261+
262+ doGitPushTestRepository (dstPath )(t )
263+
264+ testPullMerge (t , session , elem [1 ], elem [2 ], elem [4 ], MergeOptions {
265+ Style : repo_model .MergeStyleSquash ,
266+ DeleteBranch : false ,
267+ })
268+ })
269+ }
270+
243271func TestPullSquashWithHeadCommitID (t * testing.T ) {
244272 onGiteaRun (t , func (t * testing.T , giteaURL * url.URL ) {
245273 hookTasks , err := webhook .HookTasks (t .Context (), 1 , 1 ) // Retrieve previous hook number
0 commit comments