@@ -1110,3 +1110,33 @@ func TestPullNonMergeForAdminWithBranchProtection(t *testing.T) {
11101110 session .MakeRequest (t , mergeReq , http .StatusMethodNotAllowed )
11111111 })
11121112}
1113+
1114+ func TestPullSquashMergeEmpty (t * testing.T ) {
1115+ onGiteaRun (t , func (t * testing.T , u * url.URL ) {
1116+ session := loginUser (t , "user1" )
1117+ testEditFileToNewBranch (t , session , "user2" , "repo1" , "master" , "pr-squash-empty" , "README.md" , "Hello, World (Edited)\n " )
1118+ resp := testPullCreate (t , session , "user2" , "repo1" , false , "master" , "pr-squash-empty" , "This is a pull title" )
1119+
1120+ elem := strings .Split (test .RedirectURL (resp ), "/" )
1121+ assert .Equal (t , "pulls" , elem [3 ])
1122+
1123+ httpContext := NewAPITestContext (t , "user2" , "repo1" , auth_model .AccessTokenScopeWriteRepository )
1124+ dstPath := t .TempDir ()
1125+
1126+ u .Path = httpContext .GitPath ()
1127+ u .User = url .UserPassword ("user2" , userPassword )
1128+
1129+ t .Run ("Clone" , doGitClone (dstPath , u ))
1130+ doGitCheckoutBranch (dstPath , "-b" , "pr-squash-empty" , "remotes/origin/pr-squash-empty" )(t )
1131+ doGitCheckoutBranch (dstPath , "master" )(t )
1132+ _ , _ , err := gitcmd .NewCommand ("cherry-pick" ).AddArguments ("pr-squash-empty" ).
1133+ RunStdString (t .Context (), & gitcmd.RunOpts {
1134+ Dir : dstPath ,
1135+ })
1136+ assert .NoError (t , err )
1137+
1138+ doGitPushTestRepository (dstPath )(t )
1139+
1140+ testPullMerge (t , session , elem [1 ], elem [2 ], elem [4 ], repo_model .MergeStyleSquash , false )
1141+ })
1142+ }
0 commit comments