Dvc: add: can't track --external output with rel path [qa]

Created on 7 Aug 2020  ·  3Comments  ·  Source: iterative/dvc

Bug Report

File exists, seen here both as a relative and an absolute path:

λ ls ../data
../data
λ ls /c/Users/poj12/DVC-repos/data
/c/Users/poj12/DVC-repos/data

add --external doesn't work for the relative path, but does for the absolute one:

λ dvc add --external ../data
Adding...
ERROR: output '..\data' does not exist

λ dvc add --external /c/Users/poj12/DVC-repos/data
100% Add|███...

Is this expected? If so maybe should be mentioned in https://dvc.org/doc/user-guide/managing-external-data and https://dvc.org/doc/command-reference/add (--external option desc.) — pls xfer issue to dvc.org in that case.

Please provide information about your setup

λ dvc version
DVC version: 1.4.0+dea195.mod
---------------------------------
Platform: Python 3.8.2 on Windows-10-10.0.18362-SP0
Supports: All remotes
Cache types: hardlink, symlink
Cache directory: NTFS on C:\
Workspace directory: NTFS on C:\
Repo: dvc, git

Git Bash on Windows

bug p2-medium

All 3 comments

It seems like a bug to me.
I think we should remember about https://github.com/iterative/dvc/issues/3798 when handling this.

Ran into this again trying to test external data, but the error is different now:

λ dvc add --external ../xdata/d1 -v
2020-11-02 18:52:52,911 DEBUG: Check for update is enabled.
2020-11-02 18:52:53,154 DEBUG: Trying to spawn '['daemon', '-q', 'updater']'
2020-11-02 18:52:53,504 DEBUG: Spawned '['daemon', '-q', 'updater']'
2020-11-02 18:52:53,542 DEBUG: fetched: [(3,)]
Adding...
2020-11-02 18:52:54,322 DEBUG: fetched: [(0,)]
2020-11-02 18:52:54,380 ERROR: unexpected error - Cmd('git') failed due to: exit code(128)
  cmdline: git ls-files C:\Users\poj12\DVC-repos\xdata\d1
  stderr: 'fatal: C:\Users\poj12\DVC-repos\xdata\d1: 'C:\Users\poj12\DVC-repos\xdata\d1' is outside repository'
------------------------------------------------------------
Traceback (most recent call last):
  File "c:\users\poj12\dvc\dvc\main.py", line 76, in main
    ret = cmd.run()
  File "c:\users\poj12\dvc\dvc\command\add.py", line 17, in run
    self.repo.add(
  File "c:\users\poj12\dvc\dvc\repo\__init__.py", line 51, in wrapper
    return f(repo, *args, **kwargs)
  File "c:\users\poj12\dvc\dvc\repo\scm_context.py", line 4, in run
    result = method(repo, *args, **kw)
  File "c:\users\poj12\dvc\dvc\repo\add.py", line 90, in add
    stage.save()
  File "c:\users\poj12\dvc\dvc\stage\__init__.py", line 386, in save
    self.save_outs(allow_missing=allow_missing)
  File "c:\users\poj12\dvc\dvc\stage\__init__.py", line 398, in save_outs
    out.save()
  File "c:\users\poj12\dvc\dvc\output\base.py", line 263, in save
    self.ignore()
  File "c:\users\poj12\dvc\dvc\output\base.py", line 240, in ignore
    if self.repo.scm.is_tracked(self.fspath):
  File "c:\users\poj12\dvc\dvc\scm\git.py", line 289, in is_tracked
    return bool(self.repo.git.ls_files(path))
  File "c:\users\poj12\dvc\.venv\lib\site-packages\git\cmd.py", line 542, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "c:\users\poj12\dvc\.venv\lib\site-packages\git\cmd.py", line 1005, in _call_process
    return self.execute(call, **exec_kwargs)
  File "c:\users\poj12\dvc\.venv\lib\site-packages\git\cmd.py", line 822, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git ls-files C:\Users\poj12\DVC-repos\xdata\d1
  stderr: 'fatal: C:\Users\poj12\DVC-repos\xdata\d1: 'C:\Users\poj12\DVC-repos\xdata\d1' is outside repository'
------------------------------------------------------------
2020-11-02 18:52:56,294 DEBUG: Version info for developers:
DVC version: 1.8.4+8be0d8
---------------------------------
Platform: Python 3.8.2 on Windows-10-10.0.18362-SP0
Supports: All remotes
Cache types: <https://error.dvc.org/no-dvc-cache>
Workspace directory: NTFS on C:\
Repo: dvc, git

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
2020-11-02 18:52:56,307 DEBUG: Analytics is disabled.

p.s. still happening in 1.9.1 plus the -v also triggered #4829.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shcheklein picture shcheklein  ·  3Comments

anotherbugmaster picture anotherbugmaster  ·  3Comments

shcheklein picture shcheklein  ·  3Comments

shcheklein picture shcheklein  ·  3Comments

prihoda picture prihoda  ·  3Comments