Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exp init: don't add outs to .gitignore #7740

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion dvc/repo/experiments/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ def init(

with _disable_logging(), repo.scm_context(autostage=True, quiet=True):
stage.dump(update_lock=False)
stage.ignore_outs()
initialized_deps = init_deps(stage)
if params:
repo.scm_context.track_file(params)
Expand Down
19 changes: 13 additions & 6 deletions tests/func/experiments/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ def test_when_params_is_omitted_in_interactive_mode(tmp_dir, scm, dvc):
scm._reset()
assert scm.is_tracked("dvc.yaml")
assert not scm.is_tracked("params.yaml")
assert scm.is_tracked(".gitignore")
assert scm.is_ignored("models")


def test_init_interactive_params_validation(tmp_dir, dvc, capsys):
Expand Down Expand Up @@ -286,8 +284,6 @@ def test_init_default(tmp_dir, scm, dvc, interactive, overrides, inp, capsys):
scm._reset()
assert scm.is_tracked("dvc.yaml")
assert scm.is_tracked("params.yaml")
assert scm.is_tracked(".gitignore")
assert scm.is_ignored("models")
out, err = capsys.readouterr()

assert not out
Expand Down Expand Up @@ -365,8 +361,6 @@ def test_init_interactive_live(
scm._reset()
assert scm.is_tracked("dvc.yaml")
assert scm.is_tracked("params.yaml")
assert scm.is_tracked(".gitignore")
assert scm.is_ignored("models")

out, err = capsys.readouterr()

Expand Down Expand Up @@ -496,3 +490,16 @@ def test_init_with_live_and_metrics_plots_provided(
}
assert (tmp_dir / "src").is_dir()
assert (tmp_dir / "data").is_dir()


# Test that using an output subdir does not throw an scm error.
# See https://github.com/iterative/dvc/issues/5802.
def test_model_subdir_scm(scm, dvc):
init(
dvc,
defaults=CmdExperimentsInit.DEFAULTS,
overrides={
"cmd": "cmd",
"models": "models/predict.h5",
},
)