add Branch method for payload

This commit is contained in:
Christopher Brickley 2014-11-16 10:34:34 -05:00
parent 7a76b0e1cb
commit fe73e95554

View file

@ -10,6 +10,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"strings"
) )
var ( var (
@ -115,3 +116,8 @@ func ParseHook(raw []byte) (*Payload, error) {
} }
return hook, nil return hook, nil
} }
// Branch returns branch name from a payload
func (h *Payload) Branch() string {
return strings.Replace(h.Ref, "refs/heads/", "", -1)
}