From 3e6658d2f8232da246522fb847568d8d5fc4ea1b Mon Sep 17 00:00:00 2001 From: Micah Chalmer Date: Sat, 14 Jan 2012 21:02:50 -0500 Subject: [PATCH] Make post-receive hook handle multiple branches --- post-receive | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) mode change 100644 => 100755 post-receive diff --git a/post-receive b/post-receive old mode 100644 new mode 100755 index 2eb872a..d2a161a --- a/post-receive +++ b/post-receive @@ -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