Skip to content

dependency: don't use dvcignore #5256

@efiop

Description

@efiop
def test_run_dvcignored_dep(tmp_dir, dvc, run_copy):             
    tmp_dir.gen(                                                 
        {                                                        
            ".dvcignore": "dir\n",                               
            "dir": {"foo": "foo"},                               
        }                                                        
    )                                                            
    run_copy(                                                    
        os.path.join("dir", "foo"), "bar", name="copy-foo-to-bar"
    )                                                            
    assert (tmp_dir / "bar").read_text() == "foo"                

results in

/home/efiop/git/dvc/tests/dir_helpers.py:332: in run_copy                                                 
    return dvc.run(                                                                                       
/home/efiop/git/dvc/dvc/repo/__init__.py:49: in wrapper                                                   
    return f(repo, *args, **kwargs)                                                                       
/home/efiop/git/dvc/dvc/repo/scm_context.py:4: in run                                                     
    result = method(repo, *args, **kw)                                                                    
/home/efiop/git/dvc/dvc/repo/run.py:113: in run                                                           
    stage = create_stage(                                                                                 
/home/efiop/git/dvc/dvc/stage/__init__.py:84: in create_stage                                             
    fill_stage_dependencies(                                                                              
/home/efiop/git/dvc/dvc/stage/utils.py:97: in fill_stage_dependencies                                     
    stage.deps += loads_from(stage, deps or [], erepo=erepo)                                              
/home/efiop/git/dvc/dvc/dependency/__init__.py:95: in loads_from                                          
    return [_get(stage, s, info.copy()) for s in s_list]                                                  
/home/efiop/git/dvc/dvc/dependency/__init__.py:95: in <listcomp>                                          
    return [_get(stage, s, info.copy()) for s in s_list]                                                  
/home/efiop/git/dvc/dvc/dependency/__init__.py:81: in _get                                                
    return LocalDependency(stage, p, info)                                                                
/home/efiop/git/dvc/dvc/output/local.py:24: in __init__                                                   
    super().__init__(stage, path, *args, **kwargs)                                                        
/home/efiop/git/dvc/dvc/output/base.py:117: in __init__                                                   
    self._validate_output_path(path, stage)                                                               
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                                                                                                          
cls = <class 'dvc.dependency.local.LocalDependency'>, path = 'dir/foo', stage = Stage: 'copy-foo-to-bar'  
                                                                                                          
    @classmethod                                                                                          
    def _validate_output_path(cls, path, stage=None):                                                     
        from dvc.dvcfile import is_valid_filename                                                         
                                                                                                          
        if is_valid_filename(path):                                                                       
            raise cls.IsStageFileError(path)                                                              
                                                                                                          
        if stage:                                                                                         
            check = stage.repo.tree.dvcignore.check_ignore(path)                                          
            if check.match:                                                                               
>               raise cls.IsIgnoredError(check)                                                           
E               dvc.output.base.OutputIsIgnoredError: Path 'dir/foo' is ignored by                        
E               .dvcignore:1:dir                                                                          
                                                                                                          
/home/efiop/git/dvc/dvc/output/base.py:566: OutputIsIgnoredError                                          

because we use dvcignore in dependency tree, while we probably shouldn't.

https://discord.com/channels/485586884165107732/485596304961962003/798656464646307852

CC @PeterFogh

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