Skip to content

Commit

Permalink
exp: force add include_untracked paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dberenbaum authored and pmrowla committed Sep 25, 2023
1 parent 6502234 commit e8362db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dvc/repo/experiments/executor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def save(
stages = dvc.commit([], force=True, relink=False)
exp_hash = cls.hash_exp(stages)
if include_untracked:
dvc.scm.add(include_untracked)
dvc.scm.add(include_untracked, force=True) # type: ignore[call-arg]
cls.commit(
dvc.scm, # type: ignore[arg-type]
exp_hash,
Expand Down
12 changes: 12 additions & 0 deletions tests/func/experiments/test_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ def test_untracked_dvclock_is_included_in_exp(tmp_dir, scm, dvc):
assert fs.exists("dvc.lock")


def test_exp_save_include_untracked_force(tmp_dir, dvc, scm):
setup_stage(tmp_dir, dvc, scm)

new_file = tmp_dir / "new_file"
new_file.write_text("new_file")
dvc.scm.ignore(new_file)
exp = dvc.experiments.save(include_untracked=["new_file"])

fs = scm.get_fs(exp)
assert fs.exists("new_file")


def test_exp_save_custom_message(tmp_dir, dvc, scm):
setup_stage(tmp_dir, dvc, scm)

Expand Down

0 comments on commit e8362db

Please sign in to comment.