Fix bug that caused repositories to not be found #7870
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #7860
What it does
When upgrading to Typescript 3.9.1-rc, a line of code was detected as being in error and corrected appropriately. A test on
stat.isDirectory
was corrected tostat.isDirectory()
. However this actually introduced a problem because the code was no longer being called for files. Most of the code should not have been called for files, though it was harmless to do so because findGitRepositories returned an empty array and the rest of the code operated on empty arrays. However the final resolve to [] was needed. Failure to resolve the promise when a file ultimately broke the repository locator.A simple fix would have been to resolve when a file. However it is not necessary to wrap this in a Promise so I removed that. If there is some reason the Promise wrapper is wanted then we can leave that, but be sure to resolve it also in the inner error handler.
How to test
Check that all expected Git repositories are found. Check various situations (changing workspaces, adding and removing repositories, nested repositories, error conditions etc).
Review checklist
Reminder for reviewers