Skip to content

Error when re-importing a renamed directory #3339

@charlesbaynham

Description

@charlesbaynham

DVC 0.84.0, Mac, conda installation

Summary

When re-importing a directory from a git repository having specified an alternative output, dvc fails with an "overlapping outs" error. This does not occur if the output directory was not renamed.

Reproduction

The following code sets up a source git repo with a subdirectory and a dvc repo which imports from it. It

  • Successfully imports the subdirectory
  • Successfully reimports the subdirectory
  • Successfully imports and renames the subdirectory
  • Fails to reimport the renamed subdirectory

# Set up a source repo
mkdir source_repo
cd source_repo
git init
mkdir src
echo Here is some code > src/code.txt
git add .
git commit -m "Save some code"
cd  -

# Set up a dvc repo
mkdir dvc_repo
cd dvc_repo
git init
dvc init
git add .
git commit -m "Init DVC"

echo --- Preparations completed --
read -rsp $'Press any key to continue...\n' -n1 key

# Import "src" directory from the source repo
dvc import ../source_repo src

# Reimport same: works fine
dvc import ../source_repo src

echo ---
echo That import + reimport worked fine, but the next will fail 
echo ---
echo Now import the same directory, but rename it
read -rsp $'Press any key to continue...\n' -n1 key

# Now import src again, but rename it
dvc import -o src_renamed ../source_repo src

echo Reimport same...
read -rsp $'Press any key to continue...\n' -n1 key

# Finally, reimport the last
# This command will fail
dvc import -o src_renamed ../source_repo src

Expected behavior

No error.

Actual behaviour

ERROR: failed to import 'src' from '../source_repo'. - Paths for outs: 'src_renamed'('src_renamed.dvc') 'src_renamed/src'('src.dvc') overlap. To avoid unpredictable behaviour, rerun command with non overlapping outs paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions