summaryrefslogtreecommitdiffstats
path: root/routers/repo/branch.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/branch.go')
-rw-r--r--routers/repo/branch.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 1664f68ec1..e7eac04bce 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -57,8 +57,12 @@ func Branches(ctx *context.Context) {
// DeleteBranchPost responses for delete merged branch
func DeleteBranchPost(ctx *context.Context) {
defer redirect(ctx)
-
branchName := ctx.Query("name")
+ if branchName == ctx.Repo.Repository.DefaultBranch {
+ ctx.Flash.Error(ctx.Tr("repo.branch.default_deletion_failed", branchName))
+ return
+ }
+
isProtected, err := ctx.Repo.Repository.IsProtectedBranch(branchName, ctx.User)
if err != nil {
log.Error("DeleteBranch: %v", err)