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

Fix assignment of sensitive git-annex metadata data via glob patterns (regression introduced by #739) #793

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions heudiconv/external/dlad.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ def add_to_datalad(

# Provide metadata for sensitive information
sensitive_patterns = [
"sourcedata",
"sourcedata/**",
"*_scans.tsv", # top level
"*/*_scans.tsv", # within subj
"*/*/*_scans.tsv", # within sess/subj
"*/anat", # within subj
"*/*/anat", # within ses/subj
"*/anat/*", # within subj
"*/*/anat/*", # within ses/subj
]
for sp in sensitive_patterns:
mark_sensitive(ds, sp, annexed_files)
Expand Down
13 changes: 13 additions & 0 deletions heudiconv/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_conversion(
heuristic,
anon_cmd,
template="sourcedata/sub-{subject}/*/*/*.tgz",
xargs=["--datalad"],
)
runner(args) # run conversion

Expand Down Expand Up @@ -96,6 +97,18 @@ def test_conversion(
for key in keys:
assert orig[key] == conv[key]

# validate sensitive marking
from datalad.api import Dataset

ds = Dataset(outdir)
all_meta = dict(ds.repo.get_metadata("."))
target_rec = {"distribution-restrictions": ["sensitive"]}
for pth, meta in all_meta.items():
if "anat" in pth or "scans.tsv" in pth:
assert meta == target_rec
else:
assert meta == {}


@pytest.mark.skipif(not have_datalad, reason="no datalad")
def test_multiecho(
Expand Down