Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make post-receive hook handle multiple branches
- Loading branch information
1 parent
234bc63
commit 3e6658d
Showing
1 changed file
with
7 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |