#!/bin/sh

ROOTDIR=$(cd ${GIT_DIR}/..; pwd -P)
LOCKFILE=${GIT_DIR}/.commit
GIT=$(which git)
RM=$(which rm)

if [ -e ${LOCKFILE} ]; then
  # lock file must be deleted *prior* to below commit
  ${RM} ${LOCKFILE}

  # update the version file
  ${ROOTDIR}/.hooks/version.sh > ${ROOTDIR}/version.txt
  ${GIT} add version.txt
  ${GIT} commit --amend -C HEAD --no-verify
fi
