Merge v1.2.1-master
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
a590155b0b
commit
aeb17182b4
396 changed files with 27271 additions and 9969 deletions
39
vendor/github.com/google/go-github/github/git_refs.go
generated
vendored
39
vendor/github.com/google/go-github/github/git_refs.go
generated
vendored
|
@ -6,6 +6,7 @@
|
|||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
@ -46,8 +47,8 @@ type updateRefRequest struct {
|
|||
|
||||
// GetRef fetches the Reference object for a given Git ref.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/git/refs/#get-a-reference
|
||||
func (s *GitService) GetRef(owner string, repo string, ref string) (*Reference, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference
|
||||
func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) {
|
||||
ref = strings.TrimPrefix(ref, "refs/")
|
||||
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
|
@ -56,12 +57,12 @@ func (s *GitService) GetRef(owner string, repo string, ref string) (*Reference,
|
|||
}
|
||||
|
||||
r := new(Reference)
|
||||
resp, err := s.client.Do(req, r)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return r, resp, err
|
||||
return r, resp, nil
|
||||
}
|
||||
|
||||
// ReferenceListOptions specifies optional parameters to the
|
||||
|
@ -74,8 +75,8 @@ type ReferenceListOptions struct {
|
|||
|
||||
// ListRefs lists all refs in a repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/git/refs/#get-all-references
|
||||
func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#get-all-references
|
||||
func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
|
||||
var u string
|
||||
if opt != nil && opt.Type != "" {
|
||||
u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type)
|
||||
|
@ -93,18 +94,18 @@ func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]
|
|||
}
|
||||
|
||||
var rs []*Reference
|
||||
resp, err := s.client.Do(req, &rs)
|
||||
resp, err := s.client.Do(ctx, req, &rs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return rs, resp, err
|
||||
return rs, resp, nil
|
||||
}
|
||||
|
||||
// CreateRef creates a new ref in a repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/git/refs/#create-a-reference
|
||||
func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Reference, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#create-a-reference
|
||||
func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo)
|
||||
req, err := s.client.NewRequest("POST", u, &createRefRequest{
|
||||
// back-compat with previous behavior that didn't require 'refs/' prefix
|
||||
|
@ -116,18 +117,18 @@ func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Refe
|
|||
}
|
||||
|
||||
r := new(Reference)
|
||||
resp, err := s.client.Do(req, r)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return r, resp, err
|
||||
return r, resp, nil
|
||||
}
|
||||
|
||||
// UpdateRef updates an existing ref in a repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/git/refs/#update-a-reference
|
||||
func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#update-a-reference
|
||||
func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
|
||||
refPath := strings.TrimPrefix(*ref.Ref, "refs/")
|
||||
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refPath)
|
||||
req, err := s.client.NewRequest("PATCH", u, &updateRefRequest{
|
||||
|
@ -139,18 +140,18 @@ func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force
|
|||
}
|
||||
|
||||
r := new(Reference)
|
||||
resp, err := s.client.Do(req, r)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return r, resp, err
|
||||
return r, resp, nil
|
||||
}
|
||||
|
||||
// DeleteRef deletes a ref from a repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/git/refs/#delete-a-reference
|
||||
func (s *GitService) DeleteRef(owner string, repo string, ref string) (*Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#delete-a-reference
|
||||
func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) {
|
||||
ref = strings.TrimPrefix(ref, "refs/")
|
||||
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
|
@ -158,5 +159,5 @@ func (s *GitService) DeleteRef(owner string, repo string, ref string) (*Response
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue