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:
wxiaoguang 2024-12-31 18:45:05 +08:00 committed by GitHub
parent 58c092cfea
commit a0853e2278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 81 additions and 83 deletions

View file

@ -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 {