mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Fix rename branch 500 when the target branch is deleted but exist in database (#30430)
Fix #30428
This commit is contained in:
@ -313,7 +313,13 @@ func RenameBranchPost(ctx *context.Context) {
|
||||
|
||||
msg, err := repository.RenameBranch(ctx, ctx.Repo.Repository, ctx.Doer, ctx.Repo.GitRepo, form.From, form.To)
|
||||
if err != nil {
|
||||
ctx.ServerError("RenameBranch", err)
|
||||
switch {
|
||||
case git_model.IsErrBranchAlreadyExists(err):
|
||||
ctx.Flash.Error(ctx.Tr("repo.branch.branch_already_exists", form.To))
|
||||
ctx.Redirect(fmt.Sprintf("%s/branches", ctx.Repo.RepoLink))
|
||||
default:
|
||||
ctx.ServerError("RenameBranch", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user