@@ -1180,3 +1180,35 @@ func TestPullNonMergeForAdminWithBranchProtection(t *testing.T) {
11801180 session .MakeRequest (t , mergeReq , http .StatusMethodNotAllowed )
11811181 })
11821182}
1183+
1184+ func TestPullSquashMergeEmpty (t * testing.T ) {
1185+ onGiteaRun (t , func (t * testing.T , u * url.URL ) {
1186+ session := loginUser (t , "user1" )
1187+ testEditFileToNewBranch (t , session , "user2" , "repo1" , "master" , "pr-squash-empty" , "README.md" , "Hello, World (Edited)\n " )
1188+ resp := testPullCreate (t , session , "user2" , "repo1" , false , "master" , "pr-squash-empty" , "This is a pull title" )
1189+
1190+ elem := strings .Split (test .RedirectURL (resp ), "/" )
1191+ assert .Equal (t , "pulls" , elem [3 ])
1192+
1193+ httpContext := NewAPITestContext (t , "user2" , "repo1" , auth_model .AccessTokenScopeWriteRepository )
1194+ dstPath := t .TempDir ()
1195+
1196+ u .Path = httpContext .GitPath ()
1197+ u .User = url .UserPassword ("user2" , userPassword )
1198+
1199+ t .Run ("Clone" , doGitClone (dstPath , u ))
1200+ doGitCheckoutBranch (dstPath , "-b" , "pr-squash-empty" , "remotes/origin/pr-squash-empty" )(t )
1201+ doGitCheckoutBranch (dstPath , "master" )(t )
1202+ _ , _ , err := gitcmd .NewCommand ("cherry-pick" ).AddArguments ("pr-squash-empty" ).
1203+ WithDir (dstPath ).
1204+ RunStdString (t .Context ())
1205+ assert .NoError (t , err )
1206+
1207+ doGitPushTestRepository (dstPath )(t )
1208+
1209+ testPullMerge (t , session , elem [1 ], elem [2 ], elem [4 ], MergeOptions {
1210+ Style : repo_model .MergeStyleSquash ,
1211+ DeleteBranch : false ,
1212+ })
1213+ })
1214+ }
0 commit comments