diff --git a/dvc/dependency/repo.py b/dvc/dependency/repo.py index a4994b8923..eb3c58b5ce 100644 --- a/dvc/dependency/repo.py +++ b/dvc/dependency/repo.py @@ -98,3 +98,9 @@ def update(self, rev=None): with self._make_repo(locked=False) as repo: self.def_repo[self.PARAM_REV_LOCK] = repo.get_rev() + + def changed_checksum(self): + # From current repo point of view what describes RepoDependency is its + # origin project url and rev_lock, and it makes RepoDependency + # immutable, hence its impossible for checksum to change. + return False diff --git a/dvc/tree/base.py b/dvc/tree/base.py index 4eaf522326..18a2162d5b 100644 --- a/dvc/tree/base.py +++ b/dvc/tree/base.py @@ -250,7 +250,9 @@ def is_dir_hash(cls, hash_): return hash_.endswith(cls.CHECKSUM_DIR_SUFFIX) def get_hash(self, path_info, tree=None, **kwargs): - assert isinstance(path_info, str) or path_info.scheme == self.scheme + assert path_info and ( + isinstance(path_info, str) or path_info.scheme == self.scheme + ) if not tree: tree = self diff --git a/tests/func/test_commit.py b/tests/func/test_commit.py index 5e757d3b76..6c91abff31 100644 --- a/tests/func/test_commit.py +++ b/tests/func/test_commit.py @@ -1,3 +1,5 @@ +from os import fspath + import pytest from dvc.dvcfile import PIPELINE_FILE @@ -95,3 +97,13 @@ def test_commit_pipeline_stage(tmp_dir, dvc, run_copy): assert dvc.commit(f":{stage.addressing}") == [stage] assert dvc.commit(f"{PIPELINE_FILE}:{stage.addressing}") == [stage] assert dvc.commit(PIPELINE_FILE) == [stage] + + +def test_imported_entries_unchanged(tmp_dir, dvc, erepo_dir): + with erepo_dir.chdir(): + erepo_dir.dvc_gen("file", "file content", "initial commit") + + stage = dvc.imp(fspath(erepo_dir), "file") + + with dvc.state: + assert stage.changed_entries() == ([], [], None)