-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: windows file tree #5364
fix: windows file tree #5364
Conversation
Closing for now as on windows I would still end up with 0 files loaded when using this scan mode. |
|
Comparing that with (hopefully) the same sort of setup on MacOS
|
The issue lies here: https://github.com/micromatch/micromatch#backslashes We join the path of the directory together with the glob to do the matching:
This makes it so that the glob gets escaped and things break on windows. |
Tested on windows and found performance to be signficantly improved with this enabled. Just need to look at fixing the tests in |
// In theory, node picks the right utils automatically depending on platform | ||
// However, for testing, we need to be able to specify the platform explicitly here | ||
// else we cannot test for example for Windows on a Unix machine. | ||
const pathUtils = (platform ?? process.platform) === "win32" ? winPath : posixPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaaah, this is awesome! 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
What this PR does / why we need it:
Ensures that the
GARDEN_GIT_SCAN_MODE=repo
option works correctly on windows.That's important because on windows, spawning subprocesses can be relatively slow (see https://gregoryszorc.com/blog/2021/04/06/surprisingly-slow/) and by default we call
git
many times, which adds up for large projects and can really slow things down.Previously it was broken because of assumptions around how the file system is rooted, which didn't hold under windows.
Now comes with a small test to verify the behavior.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: