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

Function gatherMissingRepoRecords

internal/database/repo.go:1989–2004  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1987}
1988
1989func gatherMissingRepoRecords() ([]*Repository, error) {
1990 repos := make([]*Repository, 0, 10)
1991 if err := x.Where("id > 0").Iterate(new(Repository),
1992 func(idx int, bean any) error {
1993 repo := bean.(*Repository)
1994 if !com.IsDir(repo.RepoPath()) {
1995 repos = append(repos, repo)
1996 }
1997 return nil
1998 }); err != nil {
1999 if err2 := Handle.Notices().Create(context.TODO(), NoticeTypeRepository, fmt.Sprintf("gatherMissingRepoRecords: %v", err)); err2 != nil {
2000 return nil, errors.Newf("CreateRepositoryNotice: %v", err)
2001 }
2002 }
2003 return repos, nil
2004}
2005
2006// DeleteMissingRepositories deletes all repository records that lost Git files.
2007func DeleteMissingRepositories() error {

Callers 2

Calls 6

appendFunction · 0.85
IterateMethod · 0.80
WhereMethod · 0.80
RepoPathMethod · 0.80
NoticesMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected