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

Function ReinitMissingRepositories

internal/database/repo.go:2029–2048  ·  view source on GitHub ↗

ReinitMissingRepositories reinitializes all repository records that lost Git files.

()

Source from the content-addressed store, hash-verified

2027
2028// ReinitMissingRepositories reinitializes all repository records that lost Git files.
2029func ReinitMissingRepositories() error {
2030 repos, err := gatherMissingRepoRecords()
2031 if err != nil {
2032 return errors.Newf("gatherMissingRepoRecords: %v", err)
2033 }
2034
2035 if len(repos) == 0 {
2036 return nil
2037 }
2038
2039 for _, repo := range repos {
2040 log.Trace("Initializing %d/%d...", repo.OwnerID, repo.ID)
2041 if err := git.Init(repo.RepoPath(), git.InitOptions{Bare: true}); err != nil {
2042 if err2 := Handle.Notices().Create(context.TODO(), NoticeTypeRepository, fmt.Sprintf("init repository [repo_id: %d]: %v", repo.ID, err)); err2 != nil {
2043 return errors.Newf("create repository notice: %v", err)
2044 }
2045 }
2046 }
2047 return nil
2048}
2049
2050// SyncRepositoryHooks rewrites all repositories' pre-receive, update and post-receive hooks
2051// to make sure the binary and custom conf path are up-to-date.

Callers 1

OperationFunction · 0.92

Calls 4

gatherMissingRepoRecordsFunction · 0.85
RepoPathMethod · 0.80
NoticesMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected