Use git.HOME_PATH for Git HOME directory (#20114)

* Add git.HOME_PATH

* add legacy file check

* Apply suggestions from code review

Co-authored-by: zeripath <[email protected]>

* pass env GNUPGHOME to git command, move the existing .gitconfig to new home, make the fix for 1.17rc more clear.

* set git.HOME_PATH for docker images to default HOME

* Revert "set git.HOME_PATH for docker images to default HOME"

This reverts commit f120101ddc267cef74e4f4b92c783d5fc8e275a1.

* force Gitea to use a stable GNUPGHOME directory

* extra check to ensure only process dir or symlink for legacy files

* refactor variable name

* The legacy dir check (for 1.17-rc1) could be removed with 1.18 release, since users should have upgraded from 1.17-rc to 1.17-stable

* Update modules/git/git.go

Co-authored-by: Steven Kriegler <[email protected]>

* remove initFixGitHome117rc

* Update git.go

* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: zeripath <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: Steven Kriegler <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
This commit is contained in:
wxiaoguang
2022-07-08 16:09:07 +08:00
committed by GitHub
co-authored by zeripath 6543 Steven Kriegler Lunny Xiao
parent c273dea508
commit 496b8e3990
8 changed files with 64 additions and 28 deletions
+3 -3
View File
@@ -21,12 +21,12 @@ import (
func testRun(m *testing.M) error {
_ = log.NewLogger(1000, "console", "console", `{"level":"trace","stacktracelevel":"NONE","stderr":true}`)
repoRootPath, err := os.MkdirTemp(os.TempDir(), "repos")
gitHomePath, err := os.MkdirTemp(os.TempDir(), "git-home")
if err != nil {
return fmt.Errorf("unable to create temp dir: %w", err)
}
defer util.RemoveAll(repoRootPath)
setting.RepoRootPath = repoRootPath
defer util.RemoveAll(gitHomePath)
setting.Git.HomePath = gitHomePath
if err = InitOnceWithSync(context.Background()); err != nil {
return fmt.Errorf("failed to call Init: %w", err)