#!/bin/bash
# Usage: newgit path/to project-name.git"
# Create a new bare git respository

if [ -z $1 ]; then
    echo "usage: $FUNCNAME path/to project-name.git"
else
    gitdir="$1/$2"
    mkdir $gitdir
    pushd $gitdir
    git --bare init
    git --bare update-server-info
    mv hooks/post-update.sample hooks/post-update
    chmod a+x hooks/post-update
    touch git-daemon-export-ok
    popd
fi