-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
import/get: escape non-pattern LFS path parts #10416
Conversation
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #10416 +/- ##
=======================================
Coverage 90.50% 90.50%
=======================================
Files 502 503 +1
Lines 38982 39004 +22
Branches 5622 5626 +4
=======================================
+ Hits 35279 35300 +21
- Misses 3006 3007 +1
Partials 697 697 β View full report in Codecov by Sentry. |
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.
thanks @sisp ! can we expand / add test for this?
@shcheklein Done. WDYT? |
tests/func/test_scm.py
Outdated
@@ -44,3 +46,76 @@ def test_lfs_prefetch(tmp_dir, dvc, scm, mocker): | |||
with dvc.switch(rev): | |||
lfs_prefetch(dvc.dvcfs, ["foo"]) | |||
mock_fetch.assert_called_once() | |||
|
|||
|
|||
def test_download_lfs_prefetch_directory(tmp_dir, dvc, scm, mocker): |
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.
should these test belong to something like test_download.py
?
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.
Sounds good. I wasn't sure what the test structure under tests/func/
is. I've moved the tests as you suggested.
tests/func/test_scm.py
Outdated
) | ||
|
||
|
||
@pytest.mark.skipif(os.name == "nt", reason="invalid directory name syntax on Windows") |
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.
are any of special (to be escaped) symbols allowed on NT? (make a simpler test that runs there as well?)
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.
Good point. I've checked Microsoft docs and the relevant characters are *
and ?
. I've refactored the tests to test each subpattern case independently and skip only those on Windows that are incompatible. WDYT?
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, thanks @sisp . Just a few questions re the test. Thanks a lot.
Thanks for your feedback, @shcheklein! Would you mind another review? π |
thanks @sisp ! |
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.I've fixed a bug related to passing literal/non-pattern path (parts) to the LFS prefetching function from
scmrepo
which would interpret them as Unix filename patterns and result in incorrect path filtering results. Now, the literal/non-path path (parts) are escaped.See iterative/scmrepo#355 (comment) for the preceding discussion.
/cc @shcheklein