Add client-side hook
This commit is contained in:
parent
70ad496b06
commit
231394b1cd
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
checkout_branch="$(git branch --show-current)"
|
||||||
|
presentations_indexed_files="$(git diff --cached --name-only -- presentations/ | wc -l)"
|
||||||
|
indexed_files="$(git diff --cached --name-only | wc -l)"
|
||||||
|
|
||||||
|
case "$checkout_branch" in
|
||||||
|
master)
|
||||||
|
if [ "${presentations_indexed_files}" -gt 0 ]
|
||||||
|
then
|
||||||
|
cat <<\EOF
|
||||||
|
Error: Attempt to add files in presentations folder in master branch.
|
||||||
|
Files in presentations folder are to be added in special branches xelatex/*.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
xelatex/*)
|
||||||
|
if [ $presentations_indexed_files -ne $indexed_files ]
|
||||||
|
then
|
||||||
|
cat <<\EOF
|
||||||
|
Error: Attempt to add files outside presentations folder in special branch xelatex/*.
|
||||||
|
This branch follows only files in presentations folder.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*) exit 0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue