Refactor repository check and sync functions (#9854)

Move more general repository functions out of models/repo.go
This commit is contained in:
Lunny Xiao 2020-01-21 04:01:19 +08:00 committed by zeripath
parent 27c6b8fc07
commit d92781bf94
12 changed files with 313 additions and 210 deletions

View file

@ -17,6 +17,7 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
"gopkg.in/ini.v1"
)
@ -156,11 +157,11 @@ func cleanUpMigrateGitConfig(configPath string) error {
// CleanUpMigrateInfo finishes migrating repository and/or wiki with things that don't need to be done for mirrors.
func CleanUpMigrateInfo(repo *models.Repository) (*models.Repository, error) {
repoPath := repo.RepoPath()
if err := models.CreateDelegateHooks(repoPath); err != nil {
if err := createDelegateHooks(repoPath); err != nil {
return repo, fmt.Errorf("createDelegateHooks: %v", err)
}
if repo.HasWiki() {
if err := models.CreateDelegateHooks(repo.WikiPath()); err != nil {
if err := createDelegateHooks(repo.WikiPath()); err != nil {
return repo, fmt.Errorf("createDelegateHooks.(wiki): %v", err)
}
}