1
0
Fork 0
mirror of https://github.com/thomiceli/opengist.git synced 2025-01-25 15:20:36 +00:00
opengist/internal/resources/pre-receive

26 lines
433 B
Text
Raw Normal View History

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