summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-06-11 11:56:27 +0800
committerGitHub <noreply@github.com>2022-06-11 11:56:27 +0800
commit88f2e457d891c4e91a9eddab8143d0109e08dfa9 (patch)
tree7746767e490260ddfb2e28d3d9e142c29d3b2a14 /integrations
parent23422f9909e9843308b4c6f2becca9ba1ad5cef2 (diff)
downloadgitea-88f2e457d891c4e91a9eddab8143d0109e08dfa9.tar.gz
gitea-88f2e457d891c4e91a9eddab8143d0109e08dfa9.zip
Fix data-race problems in git module (quick patch) (#19934)
* Fix data-race problems in git module * use HomeDir instead of setting.RepoRootPath Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'integrations')
-rw-r--r--integrations/integration_test.go4
-rw-r--r--integrations/migration-test/migration_test.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go
index 0a41546554..ce21eb2ef7 100644
--- a/integrations/integration_test.go
+++ b/integrations/integration_test.go
@@ -275,7 +275,7 @@ func prepareTestEnv(t testing.TB, skip ...int) func() {
assert.NoError(t, unittest.LoadFixtures())
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
- assert.NoError(t, git.InitWithConfigSync(context.Background()))
+ assert.NoError(t, git.InitOnceWithSync(context.Background()))
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
if err != nil {
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
@@ -576,7 +576,7 @@ func resetFixtures(t *testing.T) {
assert.NoError(t, unittest.LoadFixtures())
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
- assert.NoError(t, git.InitWithConfigSync(context.Background()))
+ assert.NoError(t, git.InitOnceWithSync(context.Background()))
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
if err != nil {
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
diff --git a/integrations/migration-test/migration_test.go b/integrations/migration-test/migration_test.go
index 45e31ff9ac..83c31d8018 100644
--- a/integrations/migration-test/migration_test.go
+++ b/integrations/migration-test/migration_test.go
@@ -62,7 +62,7 @@ func initMigrationTest(t *testing.T) func() {
assert.True(t, len(setting.RepoRootPath) != 0)
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
- assert.NoError(t, git.InitWithConfigSync(context.Background()))
+ assert.NoError(t, git.InitOnceWithSync(context.Background()))
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
if err != nil {
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)