summaryrefslogtreecommitdiffstats
path: root/routers/repo/branch.go
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2019-04-08 00:08:02 -0500
committerLauris BH <lauris@nix.lv>2019-04-08 08:08:02 +0300
commitaa02463ded9e8618375db4a3cb3c1b2593e96a8e (patch)
treef2c8df40a83c07db4f3f4c017fb0a6d5af693f8c /routers/repo/branch.go
parent49b2f45f75960a48676c8dd2555d715da1942bd7 (diff)
downloadgitea-aa02463ded9e8618375db4a3cb3c1b2593e96a8e.tar.gz
gitea-aa02463ded9e8618375db4a3cb3c1b2593e96a8e.zip
Delete local branch if it exists (#6497)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'routers/repo/branch.go')
-rw-r--r--routers/repo/branch.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index a29519a43f..4d5b3996c9 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -71,6 +71,12 @@ func DeleteBranchPost(ctx *context.Context) {
return
}
+ // Delete branch in local copy if it exists
+ if err := ctx.Repo.Repository.DeleteLocalBranch(branchName); err != nil {
+ ctx.Flash.Error(ctx.Tr("repo.branch.deletion_failed", branchName))
+ return
+ }
+
ctx.Flash.Success(ctx.Tr("repo.branch.deletion_success", branchName))
}