mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
add: raise DoesNotExistError only if the output path does not exist (#10373)
`dvc add` command incorrectly raises a `DoesNotExistError` when a broken symlink exists in an output directory, and the target name is same as the directory's name. eg: If `data` is an output, and is the command is invoked as `dvc add data` (i.e. no virtual directory operations to perform). The expected behavior to raise a `FileNotFoundError`. `DoesNotExistError` should only be raised if the output itself does not exist. Related: https://github.com/iterative/dvc/issues/3717
This commit is contained in:
+1
-1
@@ -1365,7 +1365,7 @@ class Output:
|
||||
dry_run=not self.use_cache,
|
||||
)
|
||||
except FileNotFoundError as exc:
|
||||
if self.fs_path == path:
|
||||
if not self.exists:
|
||||
raise self.DoesNotExistError(self) from exc
|
||||
if not self.is_dir_checksum:
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user