Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jan 16, 2020

Close #3111

@contextmanager
def _make_repo(repo_url, rev=None):
if not repo_url or urlparse(repo_url).scheme == "":
if not repo_url or os.path.exists(repo_url):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using a solution suggested by @efiop , which identifies local repositories by checking if they are in the file system. There's no way a URL (e.g. https://, git@github) could be missed like that.

I'm not aware of any other edge case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, file:// but no one uses it 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we don't support file:// anywhere else, so no need to worry about it for now. Neither any user asked for it ever 🙂

Copy link
Contributor

@efiop efiop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly could use a test, but this solution so neat and trivial that it doesn't require it 👍

@efiop efiop merged commit 7d249d2 into treeverse:master Jan 16, 2020
@ghost ghost deleted the fix-3111 branch January 16, 2020 04:10
@skshetry
Copy link
Collaborator

skshetry commented Jan 16, 2020

It'd be good to have a regression test so that ssh URLs don't get broken later on? 🙂

Not related to this change though, but regarding the issue. Thoughts?

@ghost
Copy link
Author

ghost commented Jan 16, 2020

sure, @skshetry , didn't know how to test it properly, to be honest 😅

Any ideas? Do you want to send the pull request?

@efiop
Copy link
Contributor

efiop commented Jan 16, 2020

@skshetry The exists works pretty good there, as we don't mess with urls at all. Whatever we have - we just pass it to git to deal with it. You mean something like a mock test that would ensure that ssh-like git url would be passed to _make_repo instead of only to Repo()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dvc.api: doesn't work with repo with SSH URL

2 participants