forked from forgejo/forgejo
Fix uppercase default branch bug (#1965)
This commit is contained in:
parent
96152c38b1
commit
5e92b82ac6
4 changed files with 65 additions and 3 deletions
|
@ -480,9 +480,11 @@ func ProtectedBranchPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
branch := strings.ToLower(ctx.Query("branch"))
|
||||
if ctx.Repo.GitRepo.IsBranchExist(branch) &&
|
||||
repo.DefaultBranch != branch {
|
||||
branch := ctx.Query("branch")
|
||||
if !ctx.Repo.GitRepo.IsBranchExist(branch) {
|
||||
ctx.Status(404)
|
||||
return
|
||||
} else if repo.DefaultBranch != branch {
|
||||
repo.DefaultBranch = branch
|
||||
if err := ctx.Repo.GitRepo.SetDefaultBranch(branch); err != nil {
|
||||
if !git.IsErrUnsupportedVersion(err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue