|
|
|
@ -6,6 +6,7 @@ package repo |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"code.gitea.io/git" |
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
|
"code.gitea.io/gitea/modules/base" |
|
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
@ -70,12 +71,21 @@ func DeleteBranchPost(ctx *context.Context) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if err := ctx.Repo.GitRepo.DeleteBranch(branchName, git.DeleteBranchOptions{ |
|
|
|
|
Force: false, |
|
|
|
|
Force: true, |
|
|
|
|
}); err != nil { |
|
|
|
|
log.Error(4, "DeleteBranch: %v", err) |
|
|
|
|
ctx.Flash.Error(ctx.Tr("repo.branch.deletion_failed", fullBranchName)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
issueID := ctx.QueryInt64("issue_id") |
|
|
|
|
if issueID > 0 { |
|
|
|
|
if err := models.AddDeletePRBranchComment(ctx.User, ctx.Repo.Repository, issueID, branchName); err != nil { |
|
|
|
|
log.Error(4, "DeleteBranch: %v", err) |
|
|
|
|
ctx.Flash.Error(ctx.Tr("repo.branch.deletion_failed", fullBranchName)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ctx.Flash.Success(ctx.Tr("repo.branch.deletion_success", fullBranchName)) |
|
|
|
|
} |
|
|
|
|