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:
parent
58c092cfea
commit
a0853e2278
9 changed files with 81 additions and 83 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue