exp save: Use pathspec to handle include_untracked.

Closes #9061
This commit is contained in:
David de la Iglesia Castro
2023-02-21 09:43:25 +01:00
parent 47208533a2
commit 3043b6588f
2 changed files with 18 additions and 1 deletions
+14
View File
@@ -1,3 +1,5 @@
import logging
import pytest
from funcy import first
@@ -91,3 +93,15 @@ def test_exp_save_include_untracked(tmp_dir, dvc, scm, exp_stage):
dvc.experiments.apply("exp-0")
assert new_file.read_text() == "exp-0"
def test_exp_save_include_untracked_warning(tmp_dir, dvc, scm, caplog, exp_stage):
"""Regression test for https://github.com/iterative/dvc/issues/9061"""
new_dir = tmp_dir / "new_dir"
new_dir.mkdir()
(new_dir / "foo").write_text("foo")
(new_dir / "bar").write_text("bar")
with caplog.at_level(logging.WARNING, logger="dvc.repo.experiments.save"):
dvc.experiments.save(name="exp", include_untracked=["new_dir"])
assert not caplog.records