Skip to content

Commit 4e8ef03

Browse files
authored
fix: the .git should be ignored when emptying the dir (#138)
1 parent 9adce9d commit 4e8ef03

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

utils/directoryTraverse.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export function preOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
1818

1919
export function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
2020
for (const filename of fs.readdirSync(dir)) {
21+
if (filename === '.git') {
22+
continue
23+
}
2124
const fullpath = path.resolve(dir, filename)
2225
if (fs.lstatSync(fullpath).isDirectory()) {
2326
postOrderDirectoryTraverse(fullpath, dirCallback, fileCallback)

0 commit comments

Comments
 (0)