forked from forgejo/forgejo
Add git.HOME_PATH
This commit is contained in:
parent
55a22d1136
commit
7f4b6893ec
7 changed files with 31 additions and 13 deletions
|
@ -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() {
|
||||
sec := Cfg.Section("git")
|
||||
|
||||
if err := Cfg.Section("git").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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue