forked from kevadesu/forgejo
[PORT] gitea#30430: Fix rename branch 500 when the target branch is deleted but exist in database
Fix https://github.com/go-gitea/gitea/issues/30428 --- Conflict resolution: trivial and move test to own subtest run directly after `Normal`. (cherrypicked commit 9466fec879f4f2c88c7c1e7a5cffba319282ab66)
This commit is contained in:
parent
6f4827b3e0
commit
db39b8f4a7
3 changed files with 123 additions and 6 deletions
|
@ -321,6 +321,9 @@ func RenameBranchPost(ctx *context.Context) {
|
|||
if errors.Is(err, git_model.ErrBranchIsProtected) {
|
||||
ctx.Flash.Error(ctx.Tr("repo.settings.rename_branch_failed_protected", form.To))
|
||||
ctx.Redirect(fmt.Sprintf("%s/branches", ctx.Repo.RepoLink))
|
||||
} else if 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))
|
||||
} else {
|
||||
ctx.ServerError("RenameBranch", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue