diff --git a/package.json b/package.json index 05361bf..a63ad1b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/eamodio/vscode-gitlens.git" }, "engines": { - "vscode": "^1.31.0" + "vscode": "^1.36.0" }, "main": "./dist/extension", "icon": "images/gitlens-icon.png", @@ -5345,7 +5345,7 @@ "devDependencies": { "@types/lodash-es": "4.17.3", "@types/node": "10.11.7", - "@types/vscode": "1.31.0", + "@types/vscode": "1.36.0", "@typescript-eslint/eslint-plugin": "1.13.0", "@typescript-eslint/parser": "1.13.0", "circular-dependency-plugin": "5.0.2", diff --git a/src/git/gitService.ts b/src/git/gitService.ts index ff8b35c..a538819 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -362,7 +362,7 @@ export class GitService implements Disposable { repositories: string[] = [] ): Promise { return new Promise((resolve, reject) => { - fs.readdir(root, async (err, files) => { + fs.readdir(root, { withFileTypes: true }, async (err, files) => { if (err != null) { reject(err); return; @@ -373,30 +373,17 @@ export class GitService implements Disposable { return; } - const folders: string[] = []; + depth--; - const promises = files.map(file => { - const path = paths.resolve(root, file); + let f; + for (f of files) { + if (!f.isDirectory()) continue; - return new Promise((resolve2, reject2) => { - fs.stat(path, (err, stat) => { - if (file === '.git') { - repositories.push(path); - } - else if (err == null && excludes[file] !== true && stat != null && stat.isDirectory()) { - folders.push(path); - } - - resolve2(); - }); - }); - }); - - await Promise.all(promises); - - if (depth-- > 0) { - for (const folder of folders) { - await this.repositorySearchCore(folder, depth, excludes, repositories); + if (f.name === '.git') { + repositories.push(paths.resolve(root, f.name)); + } + else if (depth >= 0 && excludes[f.name] !== true) { + await this.repositorySearchCore(paths.resolve(root, f.name), depth, excludes, repositories); } } diff --git a/yarn.lock b/yarn.lock index 5515b05..4c57f3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -150,10 +150,10 @@ dependencies: source-map "^0.6.1" -"@types/vscode@1.31.0": - version "1.31.0" - resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.31.0.tgz#6238228482f8cae4973e50091153e3125f067044" - integrity sha512-uUpjvtrQ14ZEqqRE/EGuBvGbm9GuxDp76mtsnw3goMogsWmEEYS/y4eL2Zwf0rbFMh/hg3hEs+E3CvuuNEs+GA== +"@types/vscode@1.36.0": + version "1.36.0" + resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.36.0.tgz#ae60242e893d9eda9a0d96d51ef56f1a3fae14ed" + integrity sha512-SbHR3Q5g/C3N+Ila3KrRf1rSZiyHxWdOZ7X3yFHXzw6HrvRLuVZrxnwEX0lTBMRpH9LkwZdqRTgXW+D075jxkg== "@types/webpack@^4.4.24", "@types/webpack@^4.4.31": version "4.32.0"