|
@@ -5,6 +5,8 @@
|
|
package repo
|
|
package repo
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "github.com/gogits/git-module"
|
|
|
|
+
|
|
"github.com/gogits/gogs/modules/base"
|
|
"github.com/gogits/gogs/modules/base"
|
|
"github.com/gogits/gogs/modules/context"
|
|
"github.com/gogits/gogs/modules/context"
|
|
)
|
|
)
|
|
@@ -29,3 +31,20 @@ func Branches(ctx *context.Context) {
|
|
ctx.Data["Branches"] = brs
|
|
ctx.Data["Branches"] = brs
|
|
ctx.HTML(200, BRANCH)
|
|
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)
|
|
|
|
+}
|