Sfoglia il codice sorgente

Ensure that GitRepo is set on Empty repositories (#8539)

Both issues/new and settings/hooks/git expect `ctx.Repo.GitRepo` to be set.
This PR changes the context code to open the GitRepo.

Fixes #8538
tags/v1.11.0-rc1
zeripath 4 anni fa
parent
commit
1b72690cb8
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8
    2
      modules/context/repo.go

+ 8
- 2
modules/context/repo.go Vedi File

} }
} }


// repo is empty and display enable
if ctx.Repo.Repository.IsEmpty || ctx.Repo.Repository.IsBeingCreated() {
// Disable everything when the repo is being created
if ctx.Repo.Repository.IsBeingCreated() {
ctx.Data["BranchName"] = ctx.Repo.Repository.DefaultBranch ctx.Data["BranchName"] = ctx.Repo.Repository.DefaultBranch
return return
} }
} }
ctx.Repo.GitRepo = gitRepo ctx.Repo.GitRepo = gitRepo


// Stop at this point when the repo is empty.
if ctx.Repo.Repository.IsEmpty {
ctx.Data["BranchName"] = ctx.Repo.Repository.DefaultBranch
return
}

tags, err := ctx.Repo.GitRepo.GetTags() tags, err := ctx.Repo.GitRepo.GetTags()
if err != nil { if err != nil {
ctx.ServerError("GetTags", err) ctx.ServerError("GetTags", err)

Loading…
Annulla
Salva