From 6da55159a2af518f5d7e5cafbb50c356d9e96383 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 2 Sep 2016 23:18:37 -0400 Subject: [PATCH] #3589 LoadRepoConfig after ORM is initialized --- gogs.go | 2 +- models/repo.go | 4 ---- models/repo_mirror.go | 1 + routers/install.go | 6 +++--- templates/.VERSION | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/gogs.go b/gogs.go index 093f0be0e..3e80523aa 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.98.0901" +const APP_VER = "0.9.98.0902" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/repo.go b/models/repo.go index 932a0e9f2..010c9fad6 100644 --- a/models/repo.go +++ b/models/repo.go @@ -613,10 +613,6 @@ func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) { return nil, err } - // Clone to temprory path and do the init commit. - tmpDir := filepath.Join(os.TempDir(), fmt.Sprintf("%d", time.Now().Nanosecond())) - os.MkdirAll(tmpDir, os.ModePerm) - repoPath := RepoPath(u.Name, opts.Name) wikiPath := WikiPath(u.Name, opts.Name) diff --git a/models/repo_mirror.go b/models/repo_mirror.go index 7274258ea..8835c40d2 100644 --- a/models/repo_mirror.go +++ b/models/repo_mirror.go @@ -38,6 +38,7 @@ type Mirror struct { } func (m *Mirror) BeforeInsert() { + m.UpdatedUnix = time.Now().Unix() m.NextUpdateUnix = m.NextUpdate.Unix() } diff --git a/routers/install.go b/routers/install.go index 00171faa5..651f2f2f5 100644 --- a/routers/install.go +++ b/routers/install.go @@ -65,14 +65,14 @@ func GlobalInit() { if setting.InstallLock { highlight.NewContext() markdown.BuildSanitizer() - - models.LoadRepoConfig() - models.NewRepoContext() if err := models.NewEngine(); err != nil { log.Fatal(4, "Fail to initialize ORM engine: %v", err) } models.HasEngine = true + models.LoadRepoConfig() + models.NewRepoContext() + // Booting long running goroutines. cron.NewContext() models.InitSyncMirrors() diff --git a/templates/.VERSION b/templates/.VERSION index 37613d207..f49ad0de9 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.98.0901 \ No newline at end of file +0.9.98.0902 \ No newline at end of file