Skip to content
Closed
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
12 changes: 8 additions & 4 deletions dvc/command/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ def run(self):
binary=binary,
package=PKG,
)


is_repo = False

try:
repo = Repo()
root_directory = repo.root_dir
is_repo = True
except NotDvcRepoError:
root_directory = os.getcwd()

if is_repo:
# cache_dir might not exist yet (e.g. after `dvc init`), and we
# can't auto-create it, as it might cause issues if the user
# later decides to enable shared cache mode with
Expand All @@ -70,9 +76,7 @@ def run(self):
info += (
"Filesystem type (cache directory): {fs_cache}\n"
).format(fs_cache=self.get_fs_type(repo.cache.local.cache_dir))
except NotDvcRepoError:
root_directory = os.getcwd()


if psutil:
info += ("Filesystem type (workspace): {fs_root}").format(
fs_root=self.get_fs_type(os.path.abspath(root_directory))
Expand Down