repo/settings/branches: add prompt for bare repository

master
Unknwon 2017-03-27 13:12:29 -04:00
parent f40eb9774e
commit 73de9f9d6a
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
3 changed files with 9 additions and 2 deletions

View File

@ -658,6 +658,7 @@ settings.collaboration.write = Write
settings.collaboration.read = Read
settings.collaboration.undefined = Undefined
settings.branches = Branches
settings.branches_bare = You cannot manage branches for bare repository. Please push some content first.
settings.default_branch = Default Branch
settings.default_branch_desc = The default branch is considered the "base" branch for code commits, pull requests and online editing.
settings.update = Update

File diff suppressed because one or more lines are too long

View File

@ -370,6 +370,12 @@ func SettingsBranches(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.branches")
ctx.Data["PageIsSettingsBranches"] = true
if ctx.Repo.Repository.IsBare {
ctx.Flash.Info(ctx.Tr("repo.settings.branches_bare"), true)
ctx.HTML(200, SETTINGS_BRANCHES)
return
}
protectBranches, err := models.GetProtectBranchesByRepoID(ctx.Repo.Repository.ID)
if err != nil {
ctx.Handle(500, "GetProtectBranchesByRepoID", err)