Migrations (v82,v96,v99,v136) remove dependencies (#12286)

* remove dependencys

* add missing fields

* CI.restart()
This commit is contained in:
6543
2020-07-22 16:27:22 +02:00
committed by GitHub
parent 8e20daaede
commit 2753d72773
4 changed files with 35 additions and 11 deletions

View File

@ -6,9 +6,11 @@ package migrations
import (
"fmt"
"path/filepath"
"strings"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
"xorm.io/xorm"
)
@ -32,6 +34,16 @@ func fixReleaseSha1OnReleaseTable(x *xorm.Engine) error {
Name string
}
// UserPath returns the path absolute path of user repositories.
UserPath := func(userName string) string {
return filepath.Join(setting.RepoRootPath, strings.ToLower(userName))
}
// RepoPath returns repository path by given user and repository name.
RepoPath := func(userName, repoName string) string {
return filepath.Join(UserPath(userName), strings.ToLower(repoName)+".git")
}
// Update release sha1
const batchSize = 100
sess := x.NewSession()
@ -87,7 +99,7 @@ func fixReleaseSha1OnReleaseTable(x *xorm.Engine) error {
userCache[repo.OwnerID] = user
}
gitRepo, err = git.OpenRepository(models.RepoPath(user.Name, repo.Name))
gitRepo, err = git.OpenRepository(RepoPath(user.Name, repo.Name))
if err != nil {
return err
}