@@ -21,6 +21,7 @@ import (
2121 "code.gitea.io/gitea/modules/git"
2222 "code.gitea.io/gitea/modules/log"
2323 "code.gitea.io/gitea/modules/notification"
24+ "code.gitea.io/gitea/modules/repofiles"
2425 "code.gitea.io/gitea/modules/setting"
2526 "code.gitea.io/gitea/modules/util"
2627 "code.gitea.io/gitea/services/gitdiff"
@@ -928,6 +929,21 @@ func CleanUpPullRequest(ctx *context.Context) {
928929 return
929930 }
930931
932+ if err := repofiles .PushUpdate (
933+ pr .HeadRepo ,
934+ pr .HeadBranch ,
935+ models.PushUpdateOptions {
936+ RefFullName : git .BranchPrefix + pr .HeadBranch ,
937+ OldCommitID : branchCommitID ,
938+ NewCommitID : git .EmptySHA ,
939+ PusherID : ctx .User .ID ,
940+ PusherName : ctx .User .Name ,
941+ RepoUserName : pr .HeadRepo .Owner .Name ,
942+ RepoName : pr .HeadRepo .Name ,
943+ }); err != nil {
944+ log .Error ("Update: %v" , err )
945+ }
946+
931947 if err := models .AddDeletePRBranchComment (ctx .User , pr .BaseRepo , issue .ID , pr .HeadBranch ); err != nil {
932948 // Do not fail here as branch has already been deleted
933949 log .Error ("DeleteBranch: %v" , err )
0 commit comments