mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-08 17:05:45 +02:00
Fix unnecessary changes
This commit is contained in:
parent
7b0f3e6473
commit
fc25971f57
@ -15,7 +15,6 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
@ -33,7 +32,7 @@ func main() {
|
||||
flag.StringVar(&githubApiToken, "token", "", "github api token")
|
||||
flag.Parse()
|
||||
|
||||
file, err := os.CreateTemp(setting.TempDir(), prefix)
|
||||
file, err := os.CreateTemp(os.TempDir(), prefix)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create temp file. %s", err)
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/build/license"
|
||||
"code.gitea.io/gitea/modules/json"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
@ -40,7 +39,7 @@ func main() {
|
||||
flag.StringVar(&githubApiToken, "token", "", "github api token")
|
||||
flag.Parse()
|
||||
|
||||
file, err := os.CreateTemp(setting.TempDir(), prefix)
|
||||
file, err := os.CreateTemp(os.TempDir(), prefix)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create temp file. %s", err)
|
||||
}
|
||||
|
@ -15,7 +15,12 @@ import (
|
||||
|
||||
// localCopyPath returns the local repository temporary copy path.
|
||||
func localCopyPath() string {
|
||||
return filepath.Join(setting.TempDir(), "local-repo")
|
||||
if setting.Repository.Local.LocalCopyPath == "" {
|
||||
return filepath.Join(os.TempDir(), "local-repo")
|
||||
} else if !filepath.IsAbs(setting.Repository.Local.LocalCopyPath) {
|
||||
return filepath.Join(os.TempDir(), setting.Repository.Local.LocalCopyPath)
|
||||
}
|
||||
return setting.Repository.Local.LocalCopyPath
|
||||
}
|
||||
|
||||
func CleanUpTemporaryPaths() {
|
||||
|
@ -78,7 +78,7 @@ func InitTest(requireGitea bool) {
|
||||
|
||||
unittest.InitSettings()
|
||||
setting.Repository.DefaultBranch = "master" // many test code still assume that default branch is called "master"
|
||||
_ = util.RemoveAll(repo_module.LocalCopyPath())
|
||||
repo_module.CleanUpTemporaryPaths()
|
||||
|
||||
if err := git.InitFull(context.Background()); err != nil {
|
||||
log.Fatal("git.InitOnceWithSync: %v", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user