summaryrefslogtreecommitdiffstats
path: root/routers/repo/branch.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-11 12:00:29 +0800
committerGitHub <noreply@github.com>2017-02-11 12:00:29 +0800
commitcf0f451c37496c84795e98191a20350e0f5be35c (patch)
treecea8b11a1a9afbf29f828c6132dc19c07c741bdc /routers/repo/branch.go
parent3576e1ee739cc03f87e6ce98dbef2f32b517b202 (diff)
downloadgitea-cf0f451c37496c84795e98191a20350e0f5be35c.tar.gz
gitea-cf0f451c37496c84795e98191a20350e0f5be35c.zip
Add delete branch track on pull request comments (#888)
* add delete branch track on pull request comments * don't change vendor
Diffstat (limited to 'routers/repo/branch.go')
-rw-r--r--routers/repo/branch.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 104d459a7d..d040f2a560 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -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))
}