#1742 Update default branch in git repository while change in web view
This commit is contained in:
parent
f04d773f4f
commit
2c653141a8
7 changed files with 47 additions and 4 deletions
|
@ -80,8 +80,15 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
|||
repo.Name = newRepoName
|
||||
repo.LowerName = strings.ToLower(newRepoName)
|
||||
|
||||
if ctx.Repo.GitRepo.IsBranchExist(form.Branch) {
|
||||
if ctx.Repo.GitRepo.IsBranchExist(form.Branch) &&
|
||||
repo.DefaultBranch != form.Branch {
|
||||
repo.DefaultBranch = form.Branch
|
||||
if err := ctx.Repo.GitRepo.SetDefaultBranch(form.Branch); err != nil {
|
||||
if !git.IsErrUnsupportedVersion(err) {
|
||||
ctx.Handle(500, "SetDefaultBranch", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
repo.Description = form.Description
|
||||
repo.Website = form.Website
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue