-
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
add: auto convert absolute_path => relative #2975
Conversation
also not sure whether this is a bug/feature request/enhancement :D |
|
will that also affect paths written in |
@casperdcl Yes, but that is the point of this PR, right? |
I think Just pushed an update for |
Thanks @casperdcl ! Looks good! Please see some comments above 🙂 |
@efiop ok the style inconsistencies are now annoying. I feel like opening a new PR to fix things like relative imports and linting bash scripts... Would you prefer I revert imports here? |
@casperdcl We have issues for both of those already IIRC.
Let them be this time, but please don't include things like that next time. |
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 should understand that this is a backward incompatible change. Absolute paths are entirely legal in dvc, making an exception like absolute path is ok if it doesn't lie within a repo is wrong and the first reason is that repo may move:
cd /some/dira
dvc init
echo foo > /some/dirb/foo
dvc add /some/dirb/foo
rm -rf /some/dirb && mv /some/dira /some/dirb
# now we have a .dvc file with absolute ref into the repo dir
So, I suggest dropping this.
@Suor Using abs paths to in-repo files will cause adding them as external local outputs, which is not right. This change will break cases where there was a misuse, which is ok. There is no reason to drop this PR. |
@efiop but is within and out of repo dir is not constant. EDIT. This PR assumes a user made a mistake, which we don't really know. |
@Suor Git doesn't have "external" stuff, but same as it, anything inside of our repo is an in-repo data, even if user has specified an absolute path. We've received reports from confused users, hence why we are fixing it here this way. |
I think maybe we could print a warning about converting abs => relative?
Well actually I regularly do things like mess with |
I think there are more people who e.g. drag-drop files into terminals (autofilling abs paths) and then expect them to be treated as relative to the repo than people who deliberately want in-repo paths to be tracked as external/absolute paths. |
No need, when users add files this way they expect them to become in-repo ones. Our current behavior is a bug, no need to put a warning on top. 🙂
That is not the same "external" stuff that I'm talking about. So let's add a test here and we can merge it 🙂 |
If |
Good point, that might work, but I'm worried about |
I decided not to touch |
@casperdcl @Suor Adjusting |
Thanks @casperdcl ! 🙏 |
likely my highest churn ever... ~2 loc/commit and ~2 comments/loc 😮 |
repo$ dvc add $PWD/file.bin
should behave the same asdvc add file.bin
(relative paths for files within the repo)