diff options
author | Harshit Bansal <harshitbansal2015@gmail.com> | 2019-01-02 18:26:58 +0530 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-01-02 20:56:58 +0800 |
commit | 8764f1512d4fa5eba7711243ddd1ac22df4e224a (patch) | |
tree | e2cb85068a8f073e4e4616e4ad4f5682f9d2d40a | |
parent | 4c52858c39f848198a61b27a9a8fe70d12db3b44 (diff) | |
download | gitea-8764f1512d4fa5eba7711243ddd1ac22df4e224a.tar.gz gitea-8764f1512d4fa5eba7711243ddd1ac22df4e224a.zip |
branch: Trigger update when deleting branch via UI. (#5617)
Fixes: #5309.
-rw-r--r-- | routers/repo/branch.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 295aeaa24b..823b031a48 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -126,7 +126,19 @@ func deleteBranch(ctx *context.Context, branchName string) error { return err } - // Don't return error here + // Don't return error below this + if err := models.PushUpdate(branchName, models.PushUpdateOptions{ + RefFullName: git.BranchPrefix + branchName, + OldCommitID: commit.ID.String(), + NewCommitID: git.EmptySHA, + PusherID: ctx.User.ID, + PusherName: ctx.User.Name, + RepoUserName: ctx.Repo.Owner.Name, + RepoName: ctx.Repo.Repository.Name, + }); err != nil { + log.Error(4, "Update: %v", err) + } + if err := ctx.Repo.Repository.AddDeletedBranch(branchName, commit.ID.String(), ctx.User.ID); err != nil { log.Warn("AddDeletedBranch: %v", err) } |