Skip to content

Commit

Permalink
ref(pre-receive): Use bids-hook-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Mar 1, 2024
1 parent dfe57e1 commit dc245da
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions services/datalad/hooks/pre-receive
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,15 @@ function main() {
bidsignore=""
fi

# For raw datasets, do not include dataset_description
# For derivative datasets, include with 0000 separator
# Once the shift to the schema validator is complete, this distinction can go away.
local dataset_description=$(git show "${newref}:dataset_description.json")
if [ -n "$(echo ${dataset_description} | grep DatasetType.*derivative )" ]; then
dataset_description="$dataset_description\n0000\n"
else
dataset_description=""
fi
# Run validation with bidsschematools
python -m bidsschematools pre-receive-hook <<END
bids-hook-v2
$( git show "${newref}:dataset_description.json" | tr -d '\r\n' )
${bidsignore}
0001
$( git ls-tree --name-only -r "${newref}" )
END

# Run validation (with .bidsignore if we found it above)
{ echo "${dataset_description}${bidsignore}" && echo "0001" && git ls-tree --name-only -r "${newref}"; } | \
/usr/local/bin/bst pre-receive-hook
if [[ "$?" != 0 ]]; then
echo ""
echo "-------------------------------------------------------------------------"
Expand Down

0 comments on commit dc245da

Please sign in to comment.