Skip to content

Write a BIDS-friendly .gitattributes at babs init - #393

Draft
asmacdo wants to merge 1 commit into
PennLINC:mainfrom
asmacdo:gitattributes-bids-friendly
Draft

Write a BIDS-friendly .gitattributes at babs init#393
asmacdo wants to merge 1 commit into
PennLINC:mainfrom
asmacdo:gitattributes-bids-friendly

Conversation

@asmacdo

@asmacdo asmacdo commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Waiting until bids-study merges. This is just a draft, but posting now for @djarecka

babs init gave the analysis dataset yoda's default .gitattributes, which annexes everything except .git*/README/CHANGELOG, so BIDS metadata sidecars (dataset_description.json, small .json/.tsv) were annexed. Overwrite it with a rule that keeps small text in git and everything else in the annex: a file is annexed if it is binary (mimeencoding) or larger than 40kb, with explicit overrides forcing listed files into git.

Fixes #378

babs init gave the analysis dataset yoda's default .gitattributes, which
annexes everything except .git*/README/CHANGELOG, so BIDS metadata sidecars
(dataset_description.json, small *.json/*.tsv) were annexed. Overwrite it with
a rule that keeps small text in git and everything else in the annex: a file is
annexed if it is binary (mimeencoding) or larger than 40kb, with explicit
overrides forcing listed files into git.

Fixes PennLINC#378

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.53%. Comparing base (6588058) to head (d155415).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #393      +/-   ##
==========================================
+ Coverage   79.49%   79.53%   +0.04%     
==========================================
  Files          17       17              
  Lines        2121     2126       +5     
  Branches      373      373              
==========================================
+ Hits         1686     1691       +5     
  Misses        300      300              
  Partials      135      135              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yarikoptic yarikoptic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test and accompany recommended fix with a test

Comment thread babs/bootstrap.py
# larger than 40kb; the explicit lines force listed files into git regardless.
BIDS_GITATTRIBUTES = """\
* annex.backend=MD5E
* annex.largefiles=((mimeencoding=binary)or(largerthan=40kb))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* annex.largefiles=((mimeencoding=binary)or(largerthan=40kb))
* annex.largefiles=((* annex.largefiles=(((mimeencoding=binary)and(largerthan=0))or(largerthan=40kb))

add to your unittest that 0-sized files (which aren't text since can't be judged) are in git, not annex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default .gitattributes should be BIDS-friendly

3 participants