#!/bin/sh
# Get the name of the branch in the current working tree.
NAME=$(git branch | grep '*' | sed 's/* //')
# Check the branch name for a 3 to 7 digit number (an issue number).
ISSUE_NUMBER=`echo $NAME | grep -o -E 'FHQ\-[[:digit:]]+'`
# If branch contains a match for an issue number prepend the commit
# message with 'Ref <issue_number> <commit message>.
if [ -n "$ISSUE_NUMBER" ]
then
echo "[$ISSUE_NUMBER] $(cat $1)" > $1
fi