mirror of
https://github.com/go-gitea/gitea
synced 2025-07-25 19:58:36 +00:00
* Refactor repo.isBare to repo.isEmpty #5629 Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove Sync call
This commit is contained in:
@@ -63,7 +63,7 @@ func getForkRepository(ctx *context.Context) *models.Repository {
|
||||
return nil
|
||||
}
|
||||
|
||||
if forkRepo.IsBare || !perm.CanRead(models.UnitTypeCode) {
|
||||
if forkRepo.IsEmpty || !perm.CanRead(models.UnitTypeCode) {
|
||||
ctx.NotFound("getForkRepository", nil)
|
||||
return nil
|
||||
}
|
||||
|
@@ -28,10 +28,10 @@ const (
|
||||
tplMigrate base.TplName = "repo/migrate"
|
||||
)
|
||||
|
||||
// MustBeNotBare render when a repo is a bare git dir
|
||||
func MustBeNotBare(ctx *context.Context) {
|
||||
if ctx.Repo.Repository.IsBare {
|
||||
ctx.NotFound("MustBeNotBare", nil)
|
||||
// MustBeNotEmpty render when a repo is a empty git dir
|
||||
func MustBeNotEmpty(ctx *context.Context) {
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.NotFound("MustBeNotEmpty", nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,10 +30,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
tplRepoBARE base.TplName = "repo/bare"
|
||||
tplRepoHome base.TplName = "repo/home"
|
||||
tplWatchers base.TplName = "repo/watchers"
|
||||
tplForks base.TplName = "repo/forks"
|
||||
tplRepoEMPTY base.TplName = "repo/empty"
|
||||
tplRepoHome base.TplName = "repo/home"
|
||||
tplWatchers base.TplName = "repo/watchers"
|
||||
tplForks base.TplName = "repo/forks"
|
||||
)
|
||||
|
||||
func renderDirectory(ctx *context.Context, treeLink string) {
|
||||
@@ -321,8 +321,8 @@ func Home(ctx *context.Context) {
|
||||
func renderCode(ctx *context.Context) {
|
||||
ctx.Data["PageIsViewCode"] = true
|
||||
|
||||
if ctx.Repo.Repository.IsBare {
|
||||
ctx.HTML(200, tplRepoBARE)
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.HTML(200, tplRepoEMPTY)
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user