Explorar o código

repo/settings/branches: add prompt for bare repository

Unknwon %!s(int64=7) %!d(string=hai) anos
pai
achega
73de9f9d6a
Modificáronse 3 ficheiros con 7 adicións e 0 borrados
  1. 1 0
      conf/locale/locale_en-US.ini
  2. 0 0
      modules/bindata/bindata.go
  3. 6 0
      routers/repo/setting.go

+ 1 - 0
conf/locale/locale_en-US.ini

@@ -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

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
modules/bindata/bindata.go


+ 6 - 0
routers/repo/setting.go

@@ -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)

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio