Skip to content

Commit fc25971

Browse files
committed
Fix unnecessary changes
1 parent 7b0f3e6 commit fc25971

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

build/generate-gitignores.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"path/filepath"
1616
"strings"
1717

18-
"code.gitea.io/gitea/modules/setting"
1918
"code.gitea.io/gitea/modules/util"
2019
)
2120

@@ -33,7 +32,7 @@ func main() {
3332
flag.StringVar(&githubApiToken, "token", "", "github api token")
3433
flag.Parse()
3534

36-
file, err := os.CreateTemp(setting.TempDir(), prefix)
35+
file, err := os.CreateTemp(os.TempDir(), prefix)
3736
if err != nil {
3837
log.Fatalf("Failed to create temp file. %s", err)
3938
}

build/generate-licenses.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
"code.gitea.io/gitea/build/license"
2424
"code.gitea.io/gitea/modules/json"
25-
"code.gitea.io/gitea/modules/setting"
2625
"code.gitea.io/gitea/modules/util"
2726
)
2827

@@ -40,7 +39,7 @@ func main() {
4039
flag.StringVar(&githubApiToken, "token", "", "github api token")
4140
flag.Parse()
4241

43-
file, err := os.CreateTemp(setting.TempDir(), prefix)
42+
file, err := os.CreateTemp(os.TempDir(), prefix)
4443
if err != nil {
4544
log.Fatalf("Failed to create temp file. %s", err)
4645
}

modules/repository/temp.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import (
1515

1616
// localCopyPath returns the local repository temporary copy path.
1717
func localCopyPath() string {
18-
return filepath.Join(setting.TempDir(), "local-repo")
18+
if setting.Repository.Local.LocalCopyPath == "" {
19+
return filepath.Join(os.TempDir(), "local-repo")
20+
} else if !filepath.IsAbs(setting.Repository.Local.LocalCopyPath) {
21+
return filepath.Join(os.TempDir(), setting.Repository.Local.LocalCopyPath)
22+
}
23+
return setting.Repository.Local.LocalCopyPath
1924
}
2025

2126
func CleanUpTemporaryPaths() {

tests/test_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func InitTest(requireGitea bool) {
7878

7979
unittest.InitSettings()
8080
setting.Repository.DefaultBranch = "master" // many test code still assume that default branch is called "master"
81-
_ = util.RemoveAll(repo_module.LocalCopyPath())
81+
repo_module.CleanUpTemporaryPaths()
8282

8383
if err := git.InitFull(context.Background()); err != nil {
8484
log.Fatal("git.InitOnceWithSync: %v", err)

0 commit comments

Comments
 (0)