Optmize git-fsck options and fix #820
This commit is contained in:
parent
0b56272c13
commit
c73e9057ae
6 changed files with 32 additions and 16 deletions
|
@ -16,7 +16,9 @@ var c = New()
|
|||
func NewCronContext() {
|
||||
c.AddFunc("Update mirrors", "@every 1h", models.MirrorUpdate)
|
||||
c.AddFunc("Deliver hooks", fmt.Sprintf("@every %dm", setting.WebhookTaskInterval), models.DeliverHooks)
|
||||
c.AddFunc("Repository health check", "@every 1h", models.GitFsck)
|
||||
if setting.Git.Fsck.Enable {
|
||||
c.AddFunc("Repository health check", fmt.Sprintf("@every %dh", setting.Git.Fsck.Interval), models.GitFsck)
|
||||
}
|
||||
c.Start()
|
||||
}
|
||||
|
||||
|
|
|
@ -107,9 +107,15 @@ var (
|
|||
SessionConfig session.Options
|
||||
|
||||
// Git settings.
|
||||
MaxGitDiffLines int
|
||||
GitFsckArgs []string
|
||||
GitGcArgs []string
|
||||
Git struct {
|
||||
MaxGitDiffLines int
|
||||
GcArgs []string `delim:" "`
|
||||
Fsck struct {
|
||||
Enable bool
|
||||
Interval int
|
||||
Args []string `delim:" "`
|
||||
} `ini:"git.fsck"`
|
||||
}
|
||||
|
||||
// I18n settings.
|
||||
Langs, Names []string
|
||||
|
@ -174,6 +180,7 @@ func NewConfigContext() {
|
|||
} else {
|
||||
log.Warn("No custom 'conf/app.ini' found, please go to '/install'")
|
||||
}
|
||||
Cfg.NameMapper = ini.AllCapsUnderscore
|
||||
|
||||
LogRootPath = Cfg.Section("log").Key("ROOT_PATH").MustString(path.Join(workDir, "log"))
|
||||
|
||||
|
@ -291,10 +298,9 @@ func NewConfigContext() {
|
|||
}
|
||||
DisableGravatar = sec.Key("DISABLE_GRAVATAR").MustBool()
|
||||
|
||||
sec = Cfg.Section("git")
|
||||
MaxGitDiffLines = sec.Key("MAX_GITDIFF_LINES").MustInt(10000)
|
||||
GitFsckArgs = sec.Key("FSCK_ARGS").Strings(" ")
|
||||
GitGcArgs = sec.Key("GC_ARGS").Strings(" ")
|
||||
if err = Cfg.Section("git").MapTo(&Git); err != nil {
|
||||
log.Fatal(4, "Fail to map Git settings: %v", err)
|
||||
}
|
||||
|
||||
Langs = Cfg.Section("i18n").Key("LANGS").Strings(",")
|
||||
Names = Cfg.Section("i18n").Key("NAMES").Strings(",")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue