Skip to content

Commit a4b1967

Browse files
authored
Fix delete pull head ref for DeleteIssue (#20032) (#20034)
Backport #20032 In DeleteIssue the PR git head reference should be `/refs/pull/xxx/head` not `/refs/pull/xxx` Fix #19655 Signed-off-by: a1012112796 <[email protected]>
1 parent 8733f4b commit a4b1967

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

routers/web/repo/issue.go

+5
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,11 @@ func DeleteIssue(ctx *context.Context) {
878878
return
879879
}
880880

881+
if issue.IsPull {
882+
ctx.Redirect(fmt.Sprintf("%s/pulls", ctx.Repo.Repository.HTMLURL()), http.StatusSeeOther)
883+
return
884+
}
885+
881886
ctx.Redirect(fmt.Sprintf("%s/issues", ctx.Repo.Repository.HTMLURL()), http.StatusSeeOther)
882887
}
883888

services/issue/issue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m
149149

150150
// delete pull request related git data
151151
if issue.IsPull {
152-
if err := gitRepo.RemoveReference(fmt.Sprintf("%s%d", git.PullPrefix, issue.PullRequest.Index)); err != nil {
152+
if err := gitRepo.RemoveReference(fmt.Sprintf("%s%d/head", git.PullPrefix, issue.PullRequest.Index)); err != nil {
153153
return err
154154
}
155155
}

0 commit comments

Comments
 (0)