Skip to content

Commit

Permalink
fix: deactivate dirty check in provision-command
Browse files Browse the repository at this point in the history
This commit disables the dirty check in the provisioning
command because `Dataset.status` does not work as expected
when executed in the context of a git annex special remote.

In this context it might detect a changed subdataset, which
should not happen. The reason for this is not clear yet.
Once this is resolved, this commit could be reverted.
  • Loading branch information
christian-monch committed Dec 12, 2024
1 parent c6c24f9 commit 0cb90de
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
14 changes: 0 additions & 14 deletions datalad_remake/commands/provision_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,6 @@ def provide(
+ ([source_branch] if source_branch else [])
)
call_git_lines(args, cwd=dataset.pathobj)

is_dirty = False
for element in get_dirty_elements(dataset):
is_dirty = True
yield get_status_dict(
action='provision',
path=element['path'],
status='error',
state=element['state'],
message=f'cannot provision {element["state"]} input: {element["path"]!r} from dataset {dataset}',
)
if is_dirty:
return

worktree_dataset = Dataset(worktree_dir)

# Get all input files in the worktree
Expand Down
30 changes: 0 additions & 30 deletions datalad_remake/commands/tests/test_provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,6 @@ def test_provision_context(tmp_path):
assert not worktree.exists()


def test_unclean_dataset(tmp_path):
dataset = Dataset(tmp_path / 'ds1')
dataset.create(cfg_proc='text2git', result_renderer='disabled')
(dataset.pathobj / 'a.txt').write_text('content')
dataset.save()
(dataset.pathobj / 'a.txt').write_text('changed content')
(dataset.pathobj / 'b.txt').write_text('untracked content')

# Check that provision of unclean input results in errors
input_pattern = ['a.txt', 'b.txt']
results = dataset.provision(
input=input_pattern,
worktree_dir=tmp_path / 'ds1_worktree1',
on_failure='ignore',
result_renderer='disabled',
)
assert {(result['status'], result['state']) for result in results} == {
('error', 'modified'),
('error', 'untracked'),
}

# Check that a saved dataset can be provisioned
dataset.save()
dataset.provision(
input=input_pattern,
worktree_dir=tmp_path / 'ds1_worktree2',
result_renderer='disabled',
)


@skip_if_on_windows
def test_branch_deletion_after_provision(tmp_path):
dataset = create_ds_hierarchy(tmp_path, 'ds1', 3)[0][2]
Expand Down

0 comments on commit 0cb90de

Please sign in to comment.