MCPcopy Create free account
hub / github.com/gogs/gogs / loadAttributes

Method loadAttributes

internal/database/repo.go:256–277  ·  view source on GitHub ↗
(e Engine)

Source from the content-addressed store, hash-verified

254}
255
256func (r *Repository) loadAttributes(e Engine) (err error) {
257 if r.Owner == nil {
258 r.Owner, err = getUserByID(e, r.OwnerID)
259 if err != nil {
260 return errors.Newf("getUserByID [%d]: %v", r.OwnerID, err)
261 }
262 }
263
264 if r.IsFork && r.BaseRepo == nil {
265 r.BaseRepo, err = getRepositoryByID(e, r.ForkID)
266 if err != nil {
267 if IsErrRepoNotExist(err) {
268 r.IsFork = false
269 r.ForkID = 0
270 } else {
271 return errors.Newf("get fork repository by ID: %v", err)
272 }
273 }
274 }
275
276 return nil
277}
278
279func (r *Repository) LoadAttributes() error {
280 return r.loadAttributes(x)

Callers 3

LoadAttributesMethod · 0.95
createRepositoryFunction · 0.45
getRepositoryByIDFunction · 0.45

Implementers 2

Repositoryinternal/database/repo.go
mailerRepointernal/database/issue_mail.go

Calls 3

getUserByIDFunction · 0.85
getRepositoryByIDFunction · 0.85
IsErrRepoNotExistFunction · 0.85

Tested by

no test coverage detected