Skip to content

Incorrect error message when importing to non-existent folder #3338

@charlesbaynham

Description

@charlesbaynham

Setup

dvc 0.84.0
Mac, installation via conda

Problem

When importing a file from a git repo into a subdirectory in the current repo, dvc fails with an incorrect error message if the subdirectory does not exist.

To demonstrate this problem, run the following:

## Setup a git repo to import from
mkdir source_repo
cd source_repo
git init
echo Some code > code.txt
git add .
git commit -m "Save some code to this demo repo"

## setup a DVC repo to import from the previous
cd -
mkdir import_repo
cd import_repo
git init
dvc init
git add .
git commit -m "This is a dvc repo that will import some code"

echo --------------------------
echo The next command will fail with an incorrect error message
echo --------------------------
read -rsp $'Press any key to continue...\n' -n1 key

## Attempt an import which will fail
# This command will fail:
dvc import -o some_dir/code.txt ../source_repo code.txt

mkdir some_dir

echo --------------------------
echo Now we have made the output directory, it will succeed
echo --------------------------
read -rsp $'Press any key to continue...\n' -n1 key

dvc import -o some_dir/code.txt ../source_repo code.txt

Expected behavior

Error message stating that the output directory does not exist

Actual behaviour

This error message:

ERROR: failed to import 'code.txt' from '../source_repo'. - The path 'code.txt' does not exist in the target repository '../source_repo' neither as an output nor a git-handled file.

Note that code.txt does exist and is committed to git. DVC successfully imports it if the subdirectory some_dir exists.

Metadata

Metadata

Assignees

Labels

bugDid we break something?p1-importantImportant, aka current backlog of things to do

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions