Skip to content

Commit 233b795

Browse files
eeyrjmrwxiaoguang
andauthored
unset XDG_HOME_CONFIG as gitea manages configuration locations (#33067)
unset XDG_CONFIG_HOME early to enable gitea to manage git configuration. simple error checking to satisfy the linting. Closes #33039 --------- Co-authored-by: wxiaoguang <[email protected]>
1 parent c116770 commit 233b795

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Diff for: cmd/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ func NewMainApp(appVer AppVersion) *cli.App {
165165
app.Commands = append(app.Commands, subCmdWithConfig...)
166166
app.Commands = append(app.Commands, subCmdStandalone...)
167167

168+
setting.InitGiteaEnvVars()
168169
return app
169170
}
170171

Diff for: models/unittest/testdb.go

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func InitSettings() {
5959
_ = hash.Register("dummy", hash.NewDummyHasher)
6060

6161
setting.PasswordHashAlgo, _ = hash.SetDefaultPasswordHashAlgorithm("dummy")
62+
setting.InitGiteaEnvVars()
6263
}
6364

6465
// TestOptions represents test options

Diff for: modules/setting/config_env.go

+5
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,8 @@ func EnvironmentToConfig(cfg ConfigProvider, envs []string) (changed bool) {
166166
}
167167
return changed
168168
}
169+
170+
// InitGiteaEnvVars initilises the environment for gitea
171+
func InitGiteaEnvVars() {
172+
_ = os.Unsetenv("XDG_CONFIG_HOME") // unset if set as HOME is managed by gitea
173+
}

0 commit comments

Comments
 (0)