robbyrussell (owner)

Forks

Revisions

gist: 65330 Download_button fork
public
Description:
lighthouse ticket status updating via git commit hooks
Public Clone URL: git://gist.github.com/65330.git
Embed All Files: show embed
commit-msg.sh #
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/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