mirror of
https://github.com/go-gitea/gitea
synced 2025-08-15 05:58:27 +00:00
Before, in #19732, the old home directory is not correct. This PR introduces a new config option for git home: git.HOME_PATH, which is default to %(APP_DATA_PATH)/home And pass env GNUPGHOME to git command, force Gitea to use a stable GNUPGHOME directory
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
// Git settings
|
||||
var Git = struct {
|
||||
Path string
|
||||
HomePath string
|
||||
DisableDiffHighlight bool
|
||||
MaxGitDiffLines int
|
||||
MaxGitDiffLineCharacters int
|
||||
@@ -67,7 +69,16 @@ var Git = struct {
|
||||
}
|
||||
|
||||
func newGit() {
|
||||
if err := Cfg.Section("git").MapTo(&Git); err != nil {
|
||||
sec := Cfg.Section("git")
|
||||
|
||||
if err := sec.MapTo(&Git); err != nil {
|
||||
log.Fatal("Failed to map Git settings: %v", err)
|
||||
}
|
||||
|
||||
Git.HomePath = sec.Key("HOME_PATH").MustString("home")
|
||||
if !filepath.IsAbs(Git.HomePath) {
|
||||
Git.HomePath = filepath.Join(AppDataPath, Git.HomePath)
|
||||
} else {
|
||||
Git.HomePath = filepath.Clean(Git.HomePath)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user