Browse Source

ListCommits and ListFiles should return slices, not pointers

ref: #130
Will Norris 12 years ago
parent
commit
cf51d151a3
2 changed files with 6 additions and 6 deletions
  1. +4
    -4
      github/pulls.go
  2. +2
    -2
      github/pulls_test.go

+ 4
- 4
github/pulls.go View File

@ -148,7 +148,7 @@ func (s *PullRequestsService) Edit(owner string, repo string, number int, pull *
// ListCommits lists the commits in a pull request.
//
// GitHub API docs: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
func (s *PullRequestsService) ListCommits(owner string, repo string, number int, opt *ListOptions) (*[]Commit, *Response, error) {
func (s *PullRequestsService) ListCommits(owner string, repo string, number int, opt *ListOptions) ([]Commit, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number)
u, err := addOptions(u, opt)
if err != nil {
@ -166,13 +166,13 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int,
return nil, resp, err
}
return commits, resp, err
return *commits, resp, err
}
// ListFiles lists the files in a pull request.
//
// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests-files
func (s *PullRequestsService) ListFiles(owner string, repo string, number int, opt *ListOptions) (*[]CommitFile, *Response, error) {
func (s *PullRequestsService) ListFiles(owner string, repo string, number int, opt *ListOptions) ([]CommitFile, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number)
u, err := addOptions(u, opt)
if err != nil {
@ -190,7 +190,7 @@ func (s *PullRequestsService) ListFiles(owner string, repo string, number int, o
return nil, resp, err
}
return commitFiles, resp, err
return *commitFiles, resp, err
}
// IsMerged checks if a pull request has been merged.


+ 2
- 2
github/pulls_test.go View File

@ -174,7 +174,7 @@ func TestPullRequestsService_ListCommits(t *testing.T) {
t.Errorf("PullRequests.ListCommits returned error: %v", err)
}
want := &[]Commit{
want := []Commit{
Commit{
SHA: String("3"),
Parents: []Commit{
@ -233,7 +233,7 @@ func TestPullRequestsService_ListFiles(t *testing.T) {
t.Errorf("PullRequests.ListFiles returned error: %v", err)
}
want := &[]CommitFile{
want := []CommitFile{
CommitFile{
SHA: String("6dcb09b5b57875f334f61aebed695e2e4193db5e"),
Filename: String("file1.txt"),


Loading…
Cancel
Save