`plots diff` & `exp show`: unexpected error - Empty git repo
See original GitHub issueBug Report
Description
After initialising a repository with both Git
and DVC
both plots diff
and exp show
throw ERROR: unexpected error - Empty git repo
.
Reproduce
mkdir new
cd new
git init
dvc init
dvc exp show
=> throws errordvc plots diff
=> throws error
Expected
Neither of these commands should throws an error under these circumstances but they should return an empty dict for the --json
option.
Environment information
Output of dvc doctor
:
$ dvc doctor
DVC version: 2.18.1 (pip)
---------------------------------
Platform: Python 3.9.13 on macOS-12.5.1-arm64-arm-64bit
Supports:
http (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
https (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
webhdfs (fsspec = 2022.7.1)
Cache types: <https://error.dvc.org/no-dvc-cache>
Caches: local
Remotes: None
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git
Additional Information (if any):
This was brought up in the cross team meeting and is part of a larger discussion on error handling.
The requested behaviour is exhibited under the same circumstances for the following commands:
/new master +3 ❯ dvc list . --dvc-only --recursive --json
[]
/new master +3 ❯ dvc status --json
{}
/new master +3 ❯ dvc diff --json
{}
/new master +3 ❯ dvc data status --json
{}
Issue Analytics
- State:
- Created a year ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Git error - Fatal: Not a git repository and how to fix it | Datree.io
This error means you attempted to run a Git command, but weren't inside a Git repository. Make sure you've: Navigated to the right...
Read more >gitlab runner doesn`t work on a specific project - Stack Overflow
But after I commit/push some changes, an error occurs and failed job. I saw some solutions that upgrading the git version solved a...
Read more >Troubleshooting | Data Version Control - DVC
Failed to pull data from the cloud · Too many open files error · Unable to find credentials · Unable to connect ·...
Read more >git init | Atlassian Git Tutorial
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository...
Read more >Message "destination path 'XXX' already exists and is not an ...
Enter the directory: cd local repository directory · Clone the cloud repository to the tmp directory. git clone --no-checkout repository URL tmp.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/iterative/dvc/blob/460d08057cf355686e1337b94640ac8522497bb1/dvc/scm.py#L163
This should also be
(This does not resolve the issue, but it makes DVC generate a proper error message rather than unexpected error.)
I think we just need to do the same as
dvc diff
/exp diff
/metrics diff
/params diff
:https://github.com/iterative/dvc/blob/460d08057cf355686e1337b94640ac8522497bb1/dvc/repo/diff.py#L23-L24