Skip to content

Commit

Permalink
Make post-receive hook handle multiple branches
Browse files Browse the repository at this point in the history
  • Loading branch information
MicahChalmer committed Jan 15, 2012
1 parent 234bc63 commit 3e6658d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions post-receive 100644 → 100755
@@ -1,11 +1,12 @@
#!/bin/bash
# You may install this post-receive hook in your remote git repository
# to have automatic file upload when pushing to the repository.
read OLD_COMMIT NEW_COMMIT REFNAME
BRANCH=${REFNAME#refs/heads/}
while read OLD_COMMIT NEW_COMMIT REFNAME; do
BRANCH=${REFNAME#refs/heads/}

if [[ `grep "^\[$BRANCH\]$" ftpdata` ]]; then
echo "Uploading $BRANCH..."
exec $(dirname $(readlink -f "$0"))/git-ftp.py -b "$BRANCH" -c "$NEW_COMMIT"
fi
if [[ `grep "^\[$BRANCH\]$" ftpdata` ]]; then
echo "Uploading $BRANCH..."
$(dirname $(readlink -f "$0"))/git-ftp.py -b "$BRANCH" -c "$NEW_COMMIT" || exit $?
fi
done
true

0 comments on commit 3e6658d

Please sign in to comment.