add nidataops config to setup gitattrs
This commit is contained in:
parent
9e4da981f1
commit
02f07f9573
|
|
@ -38,5 +38,6 @@ RUN apk add --no-cache py3-pytest ca-certificates libseccomp squashfs-tools tzda
|
|||
&& rm -rf /tmp/* /var/cache/apk/*
|
||||
|
||||
RUN pip install --break-system-packages --no-cache-dir datalad datalad-container ssh_agent_setup python-gitlab
|
||||
ADD cfg_nidataops.py /usr/lib/python3.11/site-packages/datalad/resources/procedures/
|
||||
|
||||
WORKDIR /work
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Procedure to configure Git annex to add text files directly to Git"""
|
||||
|
||||
import sys
|
||||
import os.path as op
|
||||
|
||||
from datalad.distribution.dataset import require_dataset
|
||||
|
||||
ds = require_dataset(
|
||||
sys.argv[1],
|
||||
check_installed=True,
|
||||
purpose='configuration')
|
||||
|
||||
nthg = {'annex.largefiles': 'nothing'}
|
||||
anthg = {'annex.largefiles': 'anything'}
|
||||
annex_largefiles = '((mimeencoding=binary)and(largerthan=0))'
|
||||
attrs = ds.repo.get_gitattributes('*')
|
||||
if not attrs.get('*', {}).get(
|
||||
'annex.largefiles', None) == annex_largefiles:
|
||||
ds.repo.set_gitattributes([
|
||||
('*', {'annex.largefiles': annex_largefiles}),
|
||||
('.gitignore', nthg),
|
||||
('.gitmodules', nthg),
|
||||
('.gitlab-ci.yml', nthg),
|
||||
('.all-contributorsrc', nthg),
|
||||
('.bidsignore', nthg),
|
||||
('*.json', nthg),
|
||||
('*.txt', nthg),
|
||||
('*.tsv', nthg),
|
||||
('*.nii.gz', anthg),
|
||||
('*.tgz', anthg),
|
||||
('*_scans.tsv', anthg),
|
||||
# annex event files as they contain subjects behavioral responses
|
||||
('sub-*/**/*_events.tsv', anthg),
|
||||
('*.bk2', anthg),
|
||||
('*.html', anthg),
|
||||
('*.svg', anthg),
|
||||
])
|
||||
|
||||
git_attributes_file = op.join(ds.path, '.gitattributes')
|
||||
ds.save(
|
||||
git_attributes_file,
|
||||
message="Setup gitattributes for ni-dataops",
|
||||
result_renderer='disabled'
|
||||
)
|
||||
Loading…
Reference in New Issue