mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix unittest and repo create bug (#33061)
1. `StatDir` was not right, fix the FIXME 2. Clarify the test cases for `IsUsableRepoName` 3. Fix regression bug in `repo-new.ts` Fix #33060
This commit is contained in:
@@ -67,7 +67,7 @@ func SyncDirs(srcPath, destPath string) error {
|
||||
}
|
||||
|
||||
// find and delete all untracked files
|
||||
destFiles, err := util.StatDir(destPath, true)
|
||||
destFiles, err := util.ListDirRecursively(destPath, &util.ListDirOptions{IncludeDir: true})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -86,13 +86,13 @@ func SyncDirs(srcPath, destPath string) error {
|
||||
}
|
||||
|
||||
// sync src files to dest
|
||||
srcFiles, err := util.StatDir(srcPath, true)
|
||||
srcFiles, err := util.ListDirRecursively(srcPath, &util.ListDirOptions{IncludeDir: true})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, srcFile := range srcFiles {
|
||||
destFilePath := filepath.Join(destPath, srcFile)
|
||||
// util.StatDir appends a slash to the directory name
|
||||
// util.ListDirRecursively appends a slash to the directory name
|
||||
if strings.HasSuffix(srcFile, "/") {
|
||||
err = os.MkdirAll(destFilePath, os.ModePerm)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user