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/unittest/testdb.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/unittest/testdb.go')
-rw-r--r-- | models/unittest/testdb.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/models/unittest/testdb.go b/models/unittest/testdb.go index 7f9af55374..58656f781f 100644 --- a/models/unittest/testdb.go +++ b/models/unittest/testdb.go @@ -120,11 +120,9 @@ func MainTest(m *testing.M, testOpts *TestOptions) { fatalTestError("util.CopyDir: %v\n", err) } - if err = git.InitOnceWithSync(context.Background()); err != nil { + if err = git.InitFull(context.Background()); err != nil { fatalTestError("git.Init: %v\n", err) } - git.CheckLFSVersion() - ownerDirs, err := os.ReadDir(setting.RepoRootPath) if err != nil { fatalTestError("unable to read the new repo root: %v\n", err) @@ -206,8 +204,6 @@ func PrepareTestEnv(t testing.TB) { assert.NoError(t, util.RemoveAll(setting.RepoRootPath)) metaPath := filepath.Join(giteaRoot, "integrations", "gitea-repositories-meta") assert.NoError(t, CopyDir(metaPath, 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) assert.NoError(t, err) for _, ownerDir := range ownerDirs { |