aboutsummaryrefslogtreecommitdiffstats
path: root/models/unittest
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2025-01-02 11:36:50 +0800
committerGitHub <noreply@github.com>2025-01-02 11:36:50 +0800
commit4f386e2c5e39b860424faf4cbc02c16f641f956e (patch)
treee0dea226639f797db9c0e5d055aef8dad15e1315 /models/unittest
parent2852708fdf52a784182786cc2969fe5cb44400f9 (diff)
downloadgitea-4f386e2c5e39b860424faf4cbc02c16f641f956e.tar.gz
gitea-4f386e2c5e39b860424faf4cbc02c16f641f956e.zip
Refactor env var related code (#33075)
And add more comments
Diffstat (limited to 'models/unittest')
-rw-r--r--models/unittest/testdb.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/unittest/testdb.go b/models/unittest/testdb.go
index 43d084845c..7bf9829b6f 100644
--- a/models/unittest/testdb.go
+++ b/models/unittest/testdb.go
@@ -60,6 +60,12 @@ func InitSettings() {
setting.PasswordHashAlgo, _ = hash.SetDefaultPasswordHashAlgorithm("dummy")
setting.InitGiteaEnvVars()
+
+ // Avoid loading the git's system config.
+ // On macOS, system config sets the osxkeychain credential helper, which will cause tests to freeze with a dialog.
+ // But we do not set it in production at the moment, because it might be a "breaking" change,
+ // more details are in "modules/git.commonBaseEnvs".
+ _ = os.Setenv("GIT_CONFIG_NOSYSTEM", "true")
}
// TestOptions represents test options