#!/bin/sh

GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$GIT_DIR" ]; then
        echo >&2 "fatal: post-receive: GIT_DIR not set"
        exit 1
fi

GIT_REDMINE_BASE=$(git config hooks.redmineGitBase)
if [ -z "$GIT_REDMINE_BASE" ]; then
        echo >&2 "fatal: post-receive: redmineGitBase not set"
        exit 1
fi

(
        cd "$GIT_DIR"
        git push "$GIT_REDMINE_BASE/$(basename $PWD .git)"
)

