修复:gitrepo nil 问题
This commit is contained in:
parent
4df80116dc
commit
ab66f7a4de
|
@ -71,7 +71,7 @@ func Routers(ctx gocontext.Context) *web.Route {
|
|||
m.Get("/tag_name_set", context.ReferencesGitRepo(), repo.TagNameSet)
|
||||
m.Get("/branch_tag_count", context.ReferencesGitRepo(), repo.BranchTagCount)
|
||||
m.Group("/branches", func() {
|
||||
m.Get("", repo.ListBranches)
|
||||
m.Get("", context.ReferencesGitRepo(), repo.ListBranches)
|
||||
m.Get("/branches_slice", context.ReferencesGitRepo(), repo.ListBranchesSlice)
|
||||
}, reqRepoReader(unit_model.TypeCode))
|
||||
m.Group("/commits", func() {
|
||||
|
|
|
@ -30,9 +30,9 @@ func ListBranches(ctx *context.APIContext) {
|
|||
|
||||
apiBranches := make([]*gitea_api.Branch, len(branches))
|
||||
for i := range branches {
|
||||
c, err := branches[i].GetCommit()
|
||||
c, err := ctx.Repo.GitRepo.GetBranchCommit(branches[i].Name)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "GetCommit", err)
|
||||
ctx.Error(http.StatusInternalServerError, "GetBranchCommit", err)
|
||||
return
|
||||
}
|
||||
branchProtection, err := git_model.GetProtectedBranchBy(ctx, ctx.Repo.Repository.ID, branches[i].Name)
|
||||
|
|
Loading…
Reference in New Issue