1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#!/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
|