opengist/internal/resources/pre-receive

26 lines
433 B
Text
Raw Normal View History

2023-03-14 15:22:52 +00:00
#!/bin/sh
2023-04-04 00:09:00 +00:00
disallowed_files=""
2023-03-14 15:22:52 +00:00
2023-04-04 00:09:00 +00:00
while read -r old_rev new_rev ref
2023-03-14 15:22:52 +00:00
do
2023-04-04 00:09:00 +00:00
while IFS= read -r file
2023-03-14 15:22:52 +00:00
do
2023-04-04 00:09:00 +00:00
case $file in
*/*)
disallowed_files="${disallowed_files}${file} "
;;
esac
done <<EOF
$(git diff --name-only "$old_rev" "$new_rev")
EOF
2023-03-14 15:22:52 +00:00
done
2023-04-04 00:09:00 +00:00
if [ -n "$disallowed_files" ]; then
2023-03-14 15:22:52 +00:00
echo "Pushing files in folders is not allowed:"
2023-04-04 00:09:00 +00:00
for file in $disallowed_files; do
2023-03-14 15:22:52 +00:00
echo " $file"
done
exit 1
fi