Skip to content

Commit bd0cfee

Browse files
effigiesnellh
authored andcommitted
ref(pre-receive): Use bids-hook-v2
1 parent 77bbfa9 commit bd0cfee

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

services/datalad/hooks/pre-receive

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,15 @@ function main() {
129129
bidsignore=""
130130
fi
131131

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

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

0 commit comments

Comments
 (0)