From 68a71b7baadb3e2fd8e68f679a58e484f23d025d Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Wed, 18 Nov 2015 14:29:50 -0800 Subject: [PATCH 1/3] Spelling nit in remote/bitbucket.go. --- remote/bitbucket/bitbucket.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote/bitbucket/bitbucket.go b/remote/bitbucket/bitbucket.go index d1110c7b0..8965294f8 100644 --- a/remote/bitbucket/bitbucket.go +++ b/remote/bitbucket/bitbucket.go @@ -402,7 +402,7 @@ func (bb *Bitbucket) pushHook(r *http.Request) (*model.Repo, *model.Build, error continue } - // return the updated repsitory information and the + // return the updated repository information and the // build information. return convertRepo(&hook.Repo), &model.Build{ Event: model.EventPush, From d4fb58d2e684ac3e546c83480b91c05cfe6bc4d9 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Thu, 19 Nov 2015 12:38:20 -0800 Subject: [PATCH 2/3] Adding Bitbucket tag push hook support. --- remote/bitbucket/bitbucket.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/remote/bitbucket/bitbucket.go b/remote/bitbucket/bitbucket.go index 8965294f8..281d27bca 100644 --- a/remote/bitbucket/bitbucket.go +++ b/remote/bitbucket/bitbucket.go @@ -397,17 +397,26 @@ func (bb *Bitbucket) pushHook(r *http.Request) (*model.Repo, *model.Build, error // change that has branch information. for _, change := range hook.Push.Changes { - // must have branch and sha information - if change.New.Type != "branch" || change.New.Target.Hash == "" { + // must have sha information + if change.New.Target.Hash == "" { + continue + } + // we only support tag and branch pushes for now + buildEventType := model.EventPush + buildRef := fmt.Sprintf("refs/heads/%s", change.New.Name) + if change.New.Type == "tag" || change.New.Type == "annotated_tag" { + buildEventType = model.EventTag + buildRef = fmt.Sprintf("refs/tags/%s", change.New.Name) + } else if change.New.Type != "branch" { continue } // return the updated repository information and the // build information. return convertRepo(&hook.Repo), &model.Build{ - Event: model.EventPush, + Event: buildEventType, Commit: change.New.Target.Hash, - Ref: fmt.Sprintf("refs/heads/%s", change.New.Name), + Ref: buildRef, Link: change.New.Target.Links.Html.Href, Branch: change.New.Name, Message: change.New.Target.Message, From 46a9f9b9858d23276d1fbb337de4c3e6dd717c41 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Thu, 19 Nov 2015 23:43:02 -0800 Subject: [PATCH 3/3] gitgnore Jetbrains .idea dirs. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index ef5b49833..52ea38fe3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ temp/ vendor/google.golang.org/cloud vendor/github.com/bugagazavr + +# IDE/Editor stuff +.idea