aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/git_trees.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/git_trees.go')
-rw-r--r--vendor/github.com/google/go-github/github/git_trees.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/vendor/github.com/google/go-github/github/git_trees.go b/vendor/github.com/google/go-github/github/git_trees.go
index 13acfa6..bdd481f 100644
--- a/vendor/github.com/google/go-github/github/git_trees.go
+++ b/vendor/github.com/google/go-github/github/git_trees.go
@@ -5,7 +5,10 @@
package github
-import "fmt"
+import (
+ "context"
+ "fmt"
+)
// Tree represents a GitHub tree.
type Tree struct {
@@ -36,7 +39,7 @@ func (t TreeEntry) String() string {
// GetTree fetches the Tree object for a given sha hash from a repository.
//
// GitHub API docs: https://developer.github.com/v3/git/trees/#get-a-tree
-func (s *GitService) GetTree(owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
+func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
if recursive {
u += "?recursive=1"
@@ -48,7 +51,7 @@ func (s *GitService) GetTree(owner string, repo string, sha string, recursive bo
}
t := new(Tree)
- resp, err := s.client.Do(req, t)
+ resp, err := s.client.Do(ctx, req, t)
if err != nil {
return nil, resp, err
}
@@ -67,7 +70,7 @@ type createTree struct {
// that tree with the new path contents and write a new tree out.
//
// GitHub API docs: https://developer.github.com/v3/git/trees/#create-a-tree
-func (s *GitService) CreateTree(owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) {
+func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)
body := &createTree{
@@ -80,7 +83,7 @@ func (s *GitService) CreateTree(owner string, repo string, baseTree string, entr
}
t := new(Tree)
- resp, err := s.client.Do(req, t)
+ resp, err := s.client.Do(ctx, req, t)
if err != nil {
return nil, resp, err
}