diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-02-22 15:22:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 15:22:32 +0800 |
commit | c4a0a404735cdcfdcb805e9fed474c75110bca89 (patch) | |
tree | d4ef0af7722425451f23b6ca06ef90a375a5f6bc /internal/db | |
parent | f59a68c531c680d4488d8d977798f6aa36551bfa (diff) |
conf: overhaul repository settings (#5932)
Diffstat (limited to 'internal/db')
-rw-r--r-- | internal/db/migrations/v15.go | 8 | ||||
-rw-r--r-- | internal/db/migrations/v16.go | 2 | ||||
-rw-r--r-- | internal/db/mirror.go | 4 | ||||
-rw-r--r-- | internal/db/pull.go | 2 | ||||
-rw-r--r-- | internal/db/repo.go | 2 | ||||
-rw-r--r-- | internal/db/user.go | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/internal/db/migrations/v15.go b/internal/db/migrations/v15.go index 72d24143..0631e472 100644 --- a/internal/db/migrations/v15.go +++ b/internal/db/migrations/v15.go @@ -32,9 +32,9 @@ func generateAndMigrateGitHooks(x *xorm.Engine) (err error) { var ( hookNames = []string{"pre-receive", "update", "post-receive"} hookTpls = []string{ - fmt.Sprintf("#!/usr/bin/env %s\n\"%s\" hook --config='%s' pre-receive\n", conf.ScriptType, conf.AppPath(), conf.CustomConf), - fmt.Sprintf("#!/usr/bin/env %s\n\"%s\" hook --config='%s' update $1 $2 $3\n", conf.ScriptType, conf.AppPath(), conf.CustomConf), - fmt.Sprintf("#!/usr/bin/env %s\n\"%s\" hook --config='%s' post-receive\n", conf.ScriptType, conf.AppPath(), conf.CustomConf), + fmt.Sprintf("#!/usr/bin/env %s\n\"%s\" hook --config='%s' pre-receive\n", conf.Repository.ScriptType, conf.AppPath(), conf.CustomConf), + fmt.Sprintf("#!/usr/bin/env %s\n\"%s\" hook --config='%s' update $1 $2 $3\n", conf.Repository.ScriptType, conf.AppPath(), conf.CustomConf), + fmt.Sprintf("#!/usr/bin/env %s\n\"%s\" hook --config='%s' post-receive\n", conf.Repository.ScriptType, conf.AppPath(), conf.CustomConf), } ) @@ -63,7 +63,7 @@ func generateAndMigrateGitHooks(x *xorm.Engine) (err error) { return nil } - repoBase := filepath.Join(conf.RepoRootPath, strings.ToLower(user.Name), strings.ToLower(repo.Name)) + repoBase := filepath.Join(conf.Repository.Root, strings.ToLower(user.Name), strings.ToLower(repo.Name)) repoPath := repoBase + ".git" wikiPath := repoBase + ".wiki.git" log.Trace("[%04d]: %s", idx, repoPath) diff --git a/internal/db/migrations/v16.go b/internal/db/migrations/v16.go index 91bf4925..572dba9c 100644 --- a/internal/db/migrations/v16.go +++ b/internal/db/migrations/v16.go @@ -60,7 +60,7 @@ func updateRepositorySizes(x *xorm.Engine) (err error) { continue } - repoPath := filepath.Join(conf.RepoRootPath, strings.ToLower(user.Name), strings.ToLower(repo.Name)) + ".git" + repoPath := filepath.Join(conf.Repository.Root, strings.ToLower(user.Name), strings.ToLower(repo.Name)) + ".git" countObject, err := git.GetRepoSize(repoPath) if err != nil { log.Warn("GetRepoSize: %v", err) diff --git a/internal/db/mirror.go b/internal/db/mirror.go index 8a7a7b3a..b85a62b2 100644 --- a/internal/db/mirror.go +++ b/internal/db/mirror.go @@ -18,13 +18,13 @@ import ( "github.com/gogs/git-module" + "gogs.io/gogs/internal/conf" "gogs.io/gogs/internal/db/errors" "gogs.io/gogs/internal/process" - "gogs.io/gogs/internal/conf" "gogs.io/gogs/internal/sync" ) -var MirrorQueue = sync.NewUniqueQueue(conf.Repository.MirrorQueueLength) +var MirrorQueue = sync.NewUniqueQueue(1000) // Mirror represents mirror information of a repository. type Mirror struct { diff --git a/internal/db/pull.go b/internal/db/pull.go index b617a8c7..6f4f574b 100644 --- a/internal/db/pull.go +++ b/internal/db/pull.go @@ -26,7 +26,7 @@ import ( "gogs.io/gogs/internal/sync" ) -var PullRequestQueue = sync.NewUniqueQueue(conf.Repository.PullRequestQueueLength) +var PullRequestQueue = sync.NewUniqueQueue(1000) type PullRequestType int diff --git a/internal/db/repo.go b/internal/db/repo.go index 6377c2a4..ca29e305 100644 --- a/internal/db/repo.go +++ b/internal/db/repo.go @@ -857,7 +857,7 @@ func createDelegateHooks(repoPath string) (err error) { for _, name := range git.HookNames { hookPath := filepath.Join(repoPath, "hooks", name) if err = ioutil.WriteFile(hookPath, - []byte(fmt.Sprintf(hooksTpls[name], conf.ScriptType, conf.AppPath(), conf.CustomConf)), + []byte(fmt.Sprintf(hooksTpls[name], conf.Repository.ScriptType, conf.AppPath(), conf.CustomConf)), os.ModePerm); err != nil { return fmt.Errorf("create delegate hook '%s': %v", hookPath, err) } diff --git a/internal/db/user.go b/internal/db/user.go index feea7b37..ed43bc52 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -877,7 +877,7 @@ func DeleteInactivateUsers() (err error) { // UserPath returns the path absolute path of user repositories. func UserPath(userName string) string { - return filepath.Join(conf.RepoRootPath, strings.ToLower(userName)) + return filepath.Join(conf.Repository.Root, strings.ToLower(userName)) } func GetUserByKeyID(keyID int64) (*User, error) { |