aboutsummaryrefslogtreecommitdiff
path: root/routers/repo/branch.go
diff options
context:
space:
mode:
authorTanapol Nearunchorn <tanapoln@wongnai.com>2016-07-02 02:10:30 +0700
committerTanapol Nearunchorn <tanapoln@wongnai.com>2016-09-02 10:12:21 +0700
commit73fedc727538381d4e1048ee03be6b45e977a076 (patch)
tree27548e943e4ba831f24097272a8c099778d44336 /routers/repo/branch.go
parentb3d9ca4ccd7c4353db0971b61bbcbffd126cb61d (diff)
provide button to delete merged pull request
Diffstat (limited to 'routers/repo/branch.go')
-rw-r--r--routers/repo/branch.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 00f30b0f..73f6c71e 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -5,6 +5,8 @@
package repo
import (
+ "github.com/gogits/git-module"
+
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
)
@@ -29,3 +31,20 @@ func Branches(ctx *context.Context) {
ctx.Data["Branches"] = brs
ctx.HTML(200, BRANCH)
}
+
+func DeleteBranchPost(ctx *context.Context) {
+ branchName := ctx.Params(":name")
+
+ if err := ctx.Repo.GitRepo.DeleteBranch(branchName, git.DeleteBranchOptions{
+ Force: false,
+ }); err != nil {
+ ctx.Handle(500, "DeleteBranch", err)
+ return
+ }
+
+ redirectTo := ctx.Query("redirect_to")
+ if len(redirectTo) == 0 {
+ redirectTo = ctx.Repo.RepoLink
+ }
+ ctx.Redirect(redirectTo)
+}