Skip to content

Commit

Permalink
test: verify annex availability via a secondary work tree
Browse files Browse the repository at this point in the history
  • Loading branch information
mih committed Oct 25, 2024
1 parent 7d2c3ce commit 9b3a9f7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions datalad_core/repo/tests/test_worktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,31 @@ def test_worktree_init_at(tmp_path):
# we got a new instance for the repo
assert sep_wt.repo is not sep_repo_old
assert sep_wt.repo.path == sep_repo_path_new


def test_secondary_worktree_w_annex(tmp_path, annexrepo):
wt1 = Worktree(annexrepo)
test_content = 'mycontent'
test_file_name = 'myfile.dat'
test_file = wt1.path / test_file_name
test_file.write_text(test_content)
call_git(['-C', str(wt1.path), 'annex', 'add', str(test_file)])
call_git(['-C', str(wt1.path), 'commit', '-m', 'annexed file'])

branch = 'dummy'
wt2_path = tmp_path / branch
call_git(
[
'-C',
str(annexrepo),
'worktree',
'add',
str(wt2_path),
]
)
wt2 = Worktree(wt2_path)
assert wt2.annex is not None
assert wt1.annex.uuid == wt2.annex.uuid

for wt in (wt1, wt2):
assert (wt.path / test_file_name).read_text() == test_content

0 comments on commit 9b3a9f7

Please sign in to comment.