aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorMario Lubenka <mario.lubenka@googlemail.com>2019-12-26 14:17:31 +0100
committerLauris BH <lauris@nix.lv>2019-12-26 15:17:31 +0200
commit1db238154684b1fed4fd2645fa2b01c81860625a (patch)
tree7146b1b656735a9c511ff5a902e6356695a9dde2 /routers/repo
parent7bfb83e0642530183cc15f3c9208d95f88fdc79a (diff)
downloadgitea-1db238154684b1fed4fd2645fa2b01c81860625a.tar.gz
gitea-1db238154684b1fed4fd2645fa2b01c81860625a.zip
Push update after branch is restored (#9416)
* Push update after branch is restored Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Apply suggestions from code review Use name from deletedBranch Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/branch.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 306deca36e..b0a1efc5b9 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -110,6 +110,22 @@ func RestoreBranchPost(ctx *context.Context) {
return
}
+ // Don't return error below this
+ if err := repofiles.PushUpdate(
+ ctx.Repo.Repository,
+ deletedBranch.Name,
+ repofiles.PushUpdateOptions{
+ RefFullName: git.BranchPrefix + deletedBranch.Name,
+ OldCommitID: git.EmptySHA,
+ NewCommitID: deletedBranch.Commit,
+ PusherID: ctx.User.ID,
+ PusherName: ctx.User.Name,
+ RepoUserName: ctx.Repo.Owner.Name,
+ RepoName: ctx.Repo.Repository.Name,
+ }); err != nil {
+ log.Error("Update: %v", err)
+ }
+
ctx.Flash.Success(ctx.Tr("repo.branch.restore_success", deletedBranch.Name))
}