mirror of
https://github.com/thomiceli/opengist.git
synced 2025-01-09 10:02:39 +00:00
Fix pre-receive hook script
This commit is contained in:
parent
5638bf7601
commit
01184be205
1 changed files with 13 additions and 9 deletions
|
@ -1,20 +1,24 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
disallowed_files=()
|
disallowed_files=""
|
||||||
|
|
||||||
while read old_rev new_rev ref
|
while read -r old_rev new_rev ref
|
||||||
do
|
do
|
||||||
for file in $(git diff --name-only $old_rev $new_rev)
|
while IFS= read -r file
|
||||||
do
|
do
|
||||||
if [[ $file =~ / ]]; then
|
case $file in
|
||||||
disallowed_files+=($file)
|
*/*)
|
||||||
fi
|
disallowed_files="${disallowed_files}${file} "
|
||||||
done
|
;;
|
||||||
|
esac
|
||||||
|
done <<EOF
|
||||||
|
$(git diff --name-only "$old_rev" "$new_rev")
|
||||||
|
EOF
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${#disallowed_files[@]} -gt 0 ]; then
|
if [ -n "$disallowed_files" ]; then
|
||||||
echo "Pushing files in folders is not allowed:"
|
echo "Pushing files in folders is not allowed:"
|
||||||
for file in "${disallowed_files[@]}"; do
|
for file in $disallowed_files; do
|
||||||
echo " $file"
|
echo " $file"
|
||||||
done
|
done
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue