Skip to content

Commit

Permalink
imp_url: gitignore during to_remote op
Browse files Browse the repository at this point in the history
  • Loading branch information
dberenbaum authored and efiop committed Jan 3, 2024
1 parent fe008d9 commit bf5fe95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions dvc/repo/imp_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def imp_url( # noqa: PLR0913
elif to_remote:
remote_odb = self.cloud.get_remote_odb(remote, "import-url")
stage.outs[0].transfer(url, odb=remote_odb, jobs=jobs)
stage.outs[0].ignore()
stage.save_deps()
stage.md5 = stage.compute_md5()
else:
Expand Down
4 changes: 3 additions & 1 deletion tests/func/test_import_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from dvc.exceptions import InvalidArgumentError
from dvc.stage import Stage
from dvc.testing.workspace_tests import TestImport as _TestImport
from tests.utils import get_gitignore_content


def test_cmd_import(tmp_dir, dvc):
Expand Down Expand Up @@ -170,7 +171,7 @@ def test_import_url_preserve_fields(tmp_dir, dvc):
)


def test_import_url_to_remote_absolute(tmp_dir, make_tmp_dir, dvc, local_remote):
def test_import_url_to_remote_absolute(tmp_dir, make_tmp_dir, dvc, scm, local_remote):
tmp_abs_dir = make_tmp_dir("abs")
tmp_foo = tmp_abs_dir / "foo"
tmp_foo.write_text("foo")
Expand All @@ -181,6 +182,7 @@ def test_import_url_to_remote_absolute(tmp_dir, make_tmp_dir, dvc, local_remote)
assert stage.deps[0].fspath == str(tmp_foo)
assert stage.outs[0].fspath == os.fspath(foo)
assert foo.with_suffix(".dvc").exists()
assert get_gitignore_content() == ["/foo"]


def test_import_url_to_remote_invalid_combinations(dvc):
Expand Down

0 comments on commit bf5fe95

Please sign in to comment.