Skip to content

Instantly share code, notes, and snippets.

@robbyrussell
Created February 16, 2009 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save robbyrussell/65330 to your computer and use it in GitHub Desktop.
Save robbyrussell/65330 to your computer and use it in GitHub Desktop.
lighthouse ticket status updating via git commit hooks
#!/bin/sh
#
# Will append the current Lighthouse ticket number to the commit message automatically
# when you use the LH_* branch naming convention.
#
# Drop into .git/hooks/commit-msg
# chmod +x .git/hooks/commit-msg
exec < /dev/tty
commit_message=$1
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
branch=${ref#refs/heads/}
if [[ $branch =~ LH_(.*) ]]
then
lighthouse_ticket=${BASH_REMATCH[1]}
echo "What is the state of ticket #${lighthouse_ticket}? "
echo "(o)pen "
echo "(h)old"
echo "(r)esolved"
echo "Enter the current state for #${lighthouse_ticket}: (o)"
state="open"
read state_selection
case $state_selection in
"o" )
state="open"
;;
"h" )
state="hold"
;;
"r" )
state="resolved"
;;
esac
echo >&2 "[#${lighthouse_ticket} state:${state}]" >> "$1"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment