Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dvc/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def use_scm_ignore(self):
if not self.is_in_repo:
return False

return self.use_cache or self.stage.is_repo_import
return self.use_cache

@property
def cache(self):
Expand Down
21 changes: 21 additions & 0 deletions tests/func/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,24 @@ def test_update_import_url_to_remote_directory_same_hash(
"bar": {"baz": "foo"},
"same": "same",
}


def test_update_import_cache_false_no_gitignore(tmp_dir, dvc, scm, erepo_dir):
with erepo_dir.chdir():
erepo_dir.scm_gen({"file": "content"}, commit="add file")

stage = dvc.imp(os.fspath(erepo_dir), "file", "imported_file")
stage.outs[0].use_cache = False
stage.dump()

# Remove "imported_file" from .gitignore
ignore_file = tmp_dir / ".gitignore"
ignore_file.write_text("")

with erepo_dir.chdir():
erepo_dir.scm_gen("file", "new content", commit="update file")

dvc.update([stage.path])

assert (tmp_dir / "imported_file").read_text() == "new content"
assert "imported_file" not in ignore_file.read_text()