-
Notifications
You must be signed in to change notification settings - Fork 116
status: Provide special treatment of "this dataset" path #5663
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
Conversation
Codecov Report
@@ Coverage Diff @@
## maint #5663 +/- ##
==========================================
- Coverage 90.31% 84.84% -5.47%
==========================================
Files 299 296 -3
Lines 42312 42298 -14
==========================================
- Hits 38214 35888 -2326
- Misses 4098 6410 +2312
Continue to review full report at Codecov.
|
datalad/core/local/status.py
Outdated
| if dataset and root == str(p) and \ | ||
| not (orig_path.endswith(op.sep) or | ||
| orig_path == "."): | ||
| root == ds_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.
and no op.normpath or alike needed, and something like ./. or subdir/.. etc would work too? would be nice to add to the tests then.
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. At the moment, it depends on whether it's something resolve_path adjusts (and, as its docstring notes, that avoids some normalization that can be problematic for the reasons discussed in pathlib's documentation).
Given the comparison is with Dataset().path, I think the best approach is to just feed root through Dataset(). That way there should be no need to match logic or keep it in sync.
Will push an update to condition/tests.
When called with a path argument that points to a dataset and that
dataset has a parent dataset, status() checks if the original path
ends with "/". No trailing separate indicates that the dataset as a
whole is of interest, leading to a query in the parent for that
dataset.
The above logic is confusing when `dataset` and `path` point to the
same dataset. status() with a parent-less dataset works (and behaves
as the path argument ended with "/"), while a nested dataset fails
with
[ERROR ] dataset containing given paths is not underneath the
reference dataset [...]
3dea65a (BF: status: Provide special treatment of "." path,
2019-04-12) avoided the above error for the path="." case. However,
the same error can be triggered by calling status() with a path
argument other than "." that points to the same location as the
dataset argument.
Adjust the condition from 3dea65a to handle that too.
Closes datalad#5657.
8a5b2d7 to
3c68793
Compare
When called with a path argument that points to a dataset and that
dataset has a parent dataset, status() checks if the original path
ends with "/". No trailing separate indicates that the dataset as a
whole is of interest, leading to a query in the parent for that
dataset.
The above logic is confusing when
datasetandpathpoint to thesame dataset. status() with a parent-less dataset works (and behaves
as the path argument ended with "/"), while a nested dataset fails
with
3dea65a (BF: status: Provide special treatment of "." path,
2019-04-12) avoided the above error for the path="." case. However,
the same error can be triggered by calling status() with a path
argument other than "." that points to the same location as the
dataset argument.
Adjust the condition from 3dea65a to handle that too.
Closes #5657.
cc: @mih