Skip to content

Commit 1db2381

Browse files
saitholunnylafriks
committed
Push update after branch is restored (#9416)
* Push update after branch is restored Signed-off-by: Mario Lubenka <[email protected]> * Apply suggestions from code review Use name from deletedBranch Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: Lauris BH <[email protected]>
1 parent 7bfb83e commit 1db2381

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

routers/repo/branch.go

+16
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@ func RestoreBranchPost(ctx *context.Context) {
110110
return
111111
}
112112

113+
// Don't return error below this
114+
if err := repofiles.PushUpdate(
115+
ctx.Repo.Repository,
116+
deletedBranch.Name,
117+
repofiles.PushUpdateOptions{
118+
RefFullName: git.BranchPrefix + deletedBranch.Name,
119+
OldCommitID: git.EmptySHA,
120+
NewCommitID: deletedBranch.Commit,
121+
PusherID: ctx.User.ID,
122+
PusherName: ctx.User.Name,
123+
RepoUserName: ctx.Repo.Owner.Name,
124+
RepoName: ctx.Repo.Repository.Name,
125+
}); err != nil {
126+
log.Error("Update: %v", err)
127+
}
128+
113129
ctx.Flash.Success(ctx.Tr("repo.branch.restore_success", deletedBranch.Name))
114130
}
115131

0 commit comments

Comments
 (0)