diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-08-09 11:22:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 11:22:24 +0800 |
commit | 75d96f4a0274c5b7566305d494c176e1a88b1589 (patch) | |
tree | d4dc134d9fea8f0f89f895e7bf30ec39146edf32 /models/migrations/migrations_test.go | |
parent | 820031e556af9548aa07e4de2669ca52bd7f63cb (diff) | |
download | gitea-75d96f4a0274c5b7566305d494c176e1a88b1589.tar.gz gitea-75d96f4a0274c5b7566305d494c176e1a88b1589.zip |
Refactor legacy git init (#20376)
* merge `CheckLFSVersion` into `InitFull` (renamed from `InitWithSyncOnce`)
* remove the `Once` during git init, no data-race now
* for doctor sub-commands, `InitFull` should only be called in initialization stage
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/migrations/migrations_test.go')
-rw-r--r-- | models/migrations/migrations_test.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/models/migrations/migrations_test.go b/models/migrations/migrations_test.go index 46782f24a1..53e4f35395 100644 --- a/models/migrations/migrations_test.go +++ b/models/migrations/migrations_test.go @@ -66,11 +66,10 @@ func TestMain(m *testing.M) { setting.SetCustomPathAndConf("", "", "") setting.LoadForTest() - if err = git.InitOnceWithSync(context.Background()); err != nil { - fmt.Printf("Unable to InitOnceWithSync: %v\n", err) + if err = git.InitFull(context.Background()); err != nil { + fmt.Printf("Unable to InitFull: %v\n", err) os.Exit(1) } - git.CheckLFSVersion() setting.InitDBConfig() setting.NewLogServices(true) @@ -207,7 +206,6 @@ func prepareTestEnv(t *testing.T, skip int, syncModels ...interface{}) (*xorm.En deferFn := PrintCurrentTest(t, ourSkip) assert.NoError(t, os.RemoveAll(setting.RepoRootPath)) assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath)) - assert.NoError(t, git.InitOnceWithSync(context.Background())) // the gitconfig has been removed above, so sync the gitconfig again ownerDirs, err := os.ReadDir(setting.RepoRootPath) if err != nil { assert.NoError(t, err, "unable to read the new repo root: %v\n", err) |