-
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
list
: when adding a file to a dataset isdir is always true
#6094
Comments
I am able to reproduce: def test_add_new_file(tmp_dir, scm, dvc):
tmp_dir.dvc_gen({"dir": {"file": "content"}}, commit="initial commit")
tmp_dir.gen({"dir": {"new_file": "other content"}})
result = dvc.ls(str(tmp_dir), "dir", dvc_only=True)
assert result[1]['path'] == 'new_file'
assert not result[1]['isdir'] |
Some context: this one breaks a regular UI workflow on the VS code side since we rely a lot on this command now. |
@shcheklein then I guess we should bump the importance? |
@mattseddon Is this still a need for vs code? Is it a blocker? |
Should not be required once we get the new status output. |
This looks like it was actually fixed in #7345 and $ git clone [email protected]:iterative/vscode-dvc.git
Cloning into 'vscode-dvc'...
remote: Enumerating objects: 27746, done.
remote: Counting objects: 100% (287/287), done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 27746 (delta 145), reused 268 (delta 138), pack-reused 27459
Receiving objects: 100% (27746/27746), 10.50 MiB | 7.28 MiB/s, done.
Resolving deltas: 100% (20050/20050), done.
$ cd vscode-dvc/demo
$ dvc pull
A data/MNIST/raw/
A model.pt
A plots/
A logs/
4 files added and 12 files fetched
$ echo "some text" > data/MNIST/raw/newtest.txt
$ dvc list . data/MNIST/raw --show-json
[
{
"isout": false,
"isdir": false,
"isexec": false,
"path": "newtest.txt"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "t10k-images-idx3-ubyte"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "t10k-images-idx3-ubyte.gz"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "t10k-labels-idx1-ubyte"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "t10k-labels-idx1-ubyte.gz"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "train-images-idx3-ubyte"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "train-images-idx3-ubyte.gz"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "train-labels-idx1-ubyte"
},
{
"isout": true,
"isdir": false,
"isexec": false,
"path": "train-labels-idx1-ubyte.gz"
}
] However, the new file only shows up in So to borrow from @pared above, the test should probably be more like: @pytest.mark.parametrize("dvc_only", [True, False])
def test_add_new_file(tmp_dir, scm, dvc, dvc_only):
tmp_dir.dvc_gen({"dir": {"file": "content"}}, commit="initial commit")
tmp_dir.gen({"dir": {"new_file": "other content"}})
result = dvc.ls(str(tmp_dir), "dir", dvc_only=dvc_only)
assert len(result) == 1
assert result[0]['path'] == 'file' I think we can probably close this one and comment on this test case in #5712. WDYT? |
Thanks, @dberenbaum. The extension is no longer reliant on |
Bug Report
Description
When adding to a tracked dataset (folder)
isdir
fromdvc list . path/to/folder --dvc-only --show-json
is always true for the addition, even if it is a file.Reproduce
echo "some text" > data/MNIST/raw/newtest.txt
dvc list . data/MNIST/raw --show-json --dvc-only
Expected
isdir
in the output will reflect whether or not the new path represents a directory.Environment information
Output of
dvc doctor
:Originally raised here iterative/vscode-dvc#330 (comment).
The text was updated successfully, but these errors were encountered: