opengist/internal/resources/pre-receive
2023-04-04 02:09:00 +02:00

25 lines
433 B
Bash

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