Skip to content

Commit 1ad7ee8

Browse files
committed
Fix
1 parent fc448b5 commit 1ad7ee8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

modules/git/git_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
func testRun(m *testing.M) error {
20-
gitHomePath, err := os.MkdirTemp(os.TempDir(), "git-home")
20+
gitHomePath, err := os.MkdirTemp(setting.TempDir(), "git-home")
2121
if err != nil {
2222
return fmt.Errorf("unable to create temp dir: %w", err)
2323
}

modules/setting/global.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ var (
2323
// AppName is the Application name, used in the page title. ini: "APP_NAME"
2424
AppName string
2525

26+
tempDir string
2627
createTempOnce sync.Once
2728
)
2829

2930
// TempDir returns the OS temp directory
3031
func TempDir() string {
31-
tempDir := filepath.Join(os.TempDir(), "gitea")
32+
tempDir = filepath.Join(os.TempDir(), "gitea")
3233
createTempOnce.Do(func() {
3334
if err := os.MkdirAll(tempDir, os.ModePerm); err != nil {
3435
log.Fatalf("Failed to create temp directory %s: %v", tempDir, err)
@@ -38,5 +39,5 @@ func TempDir() string {
3839
}
3940

4041
func CleanUpTempDirs() {
41-
_ = os.RemoveAll(TempDir())
42+
//_ = os.RemoveAll(TempDir())
4243
}

0 commit comments

Comments
 (0)