-
Notifications
You must be signed in to change notification settings - Fork 683
Expand folder with double star pattern for recursive hash computation #994
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
base: main
Are you sure you want to change the base?
Expand folder with double star pattern for recursive hash computation #994
Conversation
🦋 Changeset detectedLatest commit: 431ee57 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Test failing due to some network error on GitHub Actions |
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.
this approach doesn't do correctly the "folder/**/folder"
Also, I think checking for glob patterns like this is not a good approach in general as there are too many edge cases it misses. I think this issue should be handled differently
d62c818 to
b20429c
Compare
|
there's an issue currently that python glob implementation doesn't include directories on */ pattern |
| const globFiles = await glob(src, { | ||
| ignore: ignorePatterns, | ||
| withFileTypes: true, | ||
| cwd: contextPath, |
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.
add this comment to the code please
| cwd: contextPath, | ||
| } | ||
| ) | ||
| dirFiles.forEach((f) => files.set(f.fullpath(), f)) |
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.
this is incorrect for the case where you have e.g. README.md in "/src/myfolder/README.md" and also in "/src/myfolder/another/README.md" and do copy("src", ".")
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.
we're adding full absolute path, not just README.md to the map
Co-authored-by: Jakub Dobry <jakub.dobry8@gmail.com>
| # If it's a directory, add the directory and all entries recursively | ||
| files.add(file_path) | ||
| dir_files = glob.glob( | ||
| os.path.join(file, "**/*"), |
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.
is this correct file full path?
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.
this is absolute path to context dir + file, same as JS version
Currently, when you provide a simple folder pattern like
folder/to copy() it will not check folders contents for changes (only the folder metadata itself) which leads to stale caches.This fix appends ** pattern when no pattern is specified for recursive hash computation.
Note
Ensure files hash includes recursive directory contents via new helper, update hashing logic, add tests, and add
wcmatchdependency.packages/js-sdk):getAllFilesForFilesHashto expand directories (incl. subpaths) respecting ignore patterns.calculateFilesHashto use the new helper, hash file content and metadata, and handle symlinks.packages/js-sdk/tests/template/utils/getAllFilesForFilesHash.test.ts.packages/python-sdk):get_all_files_for_files_hashusingwcmatch.globwithGLOBSTARfor recursive expansion.calculate_files_hashto use the new helper and hash content/metadata; handle symlinks.tests/async/template_async/utils/test_get_all_files_for_files_hash.pyandtests/sync/template_sync/utils/test_get_all_files_for_files_hash.py.wcmatchtopackages/python-sdk/pyproject.toml..changeset/green-mice-watch.md.Written by Cursor Bugbot for commit 431ee57. This will update automatically on new commits. Configure here.