2015-06-16 17:46:05 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Sets the git hooks on a new git development system
|
|
|
|
if [ -e ".git/hooks/pre-commit" ] || [ -e ".git/hooks/post-commit" ] ; then
|
|
|
|
echo 'pre-commit or post-commit git hook is already set, aborting.'
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo 'Creating pre-commit git hook...'
|
|
|
|
echo '#!/bin/sh' > .git/hooks/pre-commit
|
|
|
|
echo 'if [ -x ./_pre-commit.sh ]; then' >> .git/hooks/pre-commit
|
2018-05-15 09:23:45 +00:00
|
|
|
echo ' . ./_pre-commit.sh' >> .git/hooks/pre-commit
|
2015-06-16 17:46:05 +00:00
|
|
|
echo 'fi' >> .git/hooks/pre-commit
|
|
|
|
|
|
|
|
echo 'Creating post-commit git hook...'
|
|
|
|
echo '#!/bin/sh' > .git/hooks/post-commit
|
|
|
|
echo 'if [ -x ./_post-commit.sh ]; then' >> .git/hooks/post-commit
|
2018-05-15 09:23:45 +00:00
|
|
|
echo ' . ./_post-commit.sh' >> .git/hooks/post-commit
|
2015-06-16 17:46:05 +00:00
|
|
|
echo 'fi' >> .git/hooks/post-commit
|