#!/bin/bash
# ------------------------------------------------------------------------------
# Git Tweaks
# Copyright(c) pgRouting Contributors
#
# About:
# ------
# This script writes the current Git version into the VERSION file
# To trigger this together with every commit, run
#
#	cp tools/pre-commit .git/hooks/pre-commit
#
# Note:
# -----
# The VERSION file is always one commit behind HEAD
# ------------------------------------------------------------------------------

if [[ $BRANCH != "gh-pages" ]] 
then 
    COMMITS=`git rev-list HEAD --count`
    HASH=`git rev-parse --short HEAD`
    BRANCH=`git branch | grep '*' | awk '{print $2}'`
    echo $COMMITS-$HASH $BRANCH > $GIT_DIR/../VERSION
    git add $GIT_DIR/../VERSION
fi
