# An example hook script for the "post-receive" event.
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form
# <oldrev> <newrev> <refname>
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
# see contrib/hooks/ for a sample, or uncomment the next line and
# rename the file to "post-receive".
echo "** UPDATING $GIT_NAME **"
if [ $? != 0 ]; then
echo "cd to $GIT_PATH failed. Exit"
git fetch origin $GIT_BRANCH
files=`git diff ..FETCH_HEAD --name-only --diff-filter=ACMRTUXB`
git merge FETCH_HEAD
git submodule update
#change file owner an permissions
for file in $files
chown $GIT_USER:$GIT_GROUP $file
if [ -d "$file" ]
chmod $GIT_DIR_MOD $file
chmod $GIT_FILE_MOD $file
echo "** $GIT_NAME UPDATED**"