#! /bin/sh

PAGES_BRANCH=gh-pages
DOC_DIR=doc/html

set -e

git reset -q HEAD

# Create the tree object
git add -f $DOC_DIR
tree=$(git write-tree --prefix=$DOC_DIR)

echo "resetting the $PAGES_BRANCH branch"
commit=$(echo $msg | git commit-tree $tree)

if test -n "$commit"; then
    # And finally update the tip of the branch
    git update-ref "refs/heads/$PAGES_BRANCH" "$commit"
fi

git reset -q HEAD
git push github +$PAGES_BRANCH:$PAGES_BRANCH

