Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dvc/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import importlib
import os
import sys
from urllib.parse import urlparse
from contextlib import contextmanager, _GeneratorContextManager as GCM
import threading

Expand Down Expand Up @@ -96,7 +95,7 @@ def read(path, repo=None, rev=None, remote=None, mode="r", encoding=None):

@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 🙂

assert rev is None, "Custom revision is not supported for local repo"
yield Repo(repo_url)
else:
Expand Down