Merge pull request #1 from compressed/branch_helper

add Branch method for payload
This commit is contained in:
无闻 2014-11-16 18:00:43 -05:00
commit 2d7ad67259

View file

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