Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions example/commitpr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ func getRef() (ref *github.Reference, err error) {
// of the ref you got in getRef.
func getTree(ref *github.Reference) (tree *github.Tree, err error) {
// Create a tree with what to commit.
entries := []github.TreeEntry{}
entries := []*github.TreeEntry{}

// Load each file into the tree.
for _, fileArg := range strings.Split(*sourceFiles, ",") {
file, content, err := getFileContent(fileArg)
if err != nil {
return nil, err
}
entries = append(entries, github.TreeEntry{Path: github.String(file), Type: github.String("blob"), Content: github.String(string(content)), Mode: github.String("100644")})
entries = append(entries, &github.TreeEntry{Path: github.String(file), Type: github.String("blob"), Content: github.String(string(content)), Mode: github.String("100644")})
}

tree, _, err = client.Git.CreateTree(ctx, *sourceOwner, *sourceRepo, *ref.Object.SHA, entries)
Expand Down Expand Up @@ -135,7 +135,7 @@ func pushCommit(ref *github.Reference, tree *github.Tree) (err error) {
// Create the commit using the tree.
date := time.Now()
author := &github.CommitAuthor{Date: &date, Name: authorName, Email: authorEmail}
commit := &github.Commit{Author: author, Message: commitMessage, Tree: tree, Parents: []github.Commit{*parent.Commit}}
commit := &github.Commit{Author: author, Message: commitMessage, Tree: tree, Parents: []*github.Commit{parent.Commit}}
newCommit, _, err := client.Git.CreateCommit(ctx, *sourceOwner, *sourceRepo, commit)
if err != nil {
return err
Expand Down
14 changes: 7 additions & 7 deletions github/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type Feeds struct {
CurrentUserOrganizationURL *string `json:"current_user_organization_url,omitempty"`
CurrentUserOrganizationURLs []string `json:"current_user_organization_urls,omitempty"`
Links *struct {
Timeline *FeedLink `json:"timeline,omitempty"`
User *FeedLink `json:"user,omitempty"`
CurrentUserPublic *FeedLink `json:"current_user_public,omitempty"`
CurrentUser *FeedLink `json:"current_user,omitempty"`
CurrentUserActor *FeedLink `json:"current_user_actor,omitempty"`
CurrentUserOrganization *FeedLink `json:"current_user_organization,omitempty"`
CurrentUserOrganizations []FeedLink `json:"current_user_organizations,omitempty"`
Timeline *FeedLink `json:"timeline,omitempty"`
User *FeedLink `json:"user,omitempty"`
CurrentUserPublic *FeedLink `json:"current_user_public,omitempty"`
CurrentUser *FeedLink `json:"current_user,omitempty"`
CurrentUserActor *FeedLink `json:"current_user_actor,omitempty"`
CurrentUserOrganization *FeedLink `json:"current_user_organization,omitempty"`
CurrentUserOrganizations []*FeedLink `json:"current_user_organizations,omitempty"`
} `json:"_links,omitempty"`
}

Expand Down
16 changes: 8 additions & 8 deletions github/activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ var wantFeeds = &Feeds{
"https://github.com/organizations/github/defunkt.private.atom?token=abc123",
},
Links: &struct {
Timeline *FeedLink `json:"timeline,omitempty"`
User *FeedLink `json:"user,omitempty"`
CurrentUserPublic *FeedLink `json:"current_user_public,omitempty"`
CurrentUser *FeedLink `json:"current_user,omitempty"`
CurrentUserActor *FeedLink `json:"current_user_actor,omitempty"`
CurrentUserOrganization *FeedLink `json:"current_user_organization,omitempty"`
CurrentUserOrganizations []FeedLink `json:"current_user_organizations,omitempty"`
Timeline *FeedLink `json:"timeline,omitempty"`
User *FeedLink `json:"user,omitempty"`
CurrentUserPublic *FeedLink `json:"current_user_public,omitempty"`
CurrentUser *FeedLink `json:"current_user,omitempty"`
CurrentUserActor *FeedLink `json:"current_user_actor,omitempty"`
CurrentUserOrganization *FeedLink `json:"current_user_organization,omitempty"`
CurrentUserOrganizations []*FeedLink `json:"current_user_organizations,omitempty"`
}{
Timeline: &FeedLink{
HRef: String("https://github.com/timeline"),
Expand All @@ -148,7 +148,7 @@ var wantFeeds = &Feeds{
HRef: String(""),
Type: String(""),
},
CurrentUserOrganizations: []FeedLink{
CurrentUserOrganizations: []*FeedLink{
{
HRef: String("https://github.com/organizations/github/defunkt.private.atom?token=abc123"),
Type: String("application/atom+xml"),
Expand Down
14 changes: 7 additions & 7 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,13 @@ type PullRequestReviewCommentEvent struct {
//
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent
type PushEvent struct {
PushID *int64 `json:"push_id,omitempty"`
Head *string `json:"head,omitempty"`
Ref *string `json:"ref,omitempty"`
Size *int `json:"size,omitempty"`
Commits []PushEventCommit `json:"commits,omitempty"`
Before *string `json:"before,omitempty"`
DistinctSize *int `json:"distinct_size,omitempty"`
PushID *int64 `json:"push_id,omitempty"`
Head *string `json:"head,omitempty"`
Ref *string `json:"ref,omitempty"`
Size *int `json:"size,omitempty"`
Commits []*PushEventCommit `json:"commits,omitempty"`
Before *string `json:"before,omitempty"`
DistinctSize *int `json:"distinct_size,omitempty"`

// The following fields are only populated by Webhook events.
After *string `json:"after,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion github/git_commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Commit struct {
Committer *CommitAuthor `json:"committer,omitempty"`
Message *string `json:"message,omitempty"`
Tree *Tree `json:"tree,omitempty"`
Parents []Commit `json:"parents,omitempty"`
Parents []*Commit `json:"parents,omitempty"`
Stats *CommitStats `json:"stats,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
URL *string `json:"url,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions github/git_commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestCommit_Marshal(t *testing.T) {
Message: String("m"),
Tree: &Tree{
SHA: String("s"),
Entries: []TreeEntry{{
Entries: []*TreeEntry{{
SHA: String("s"),
Path: String("p"),
Mode: String("m"),
Expand Down Expand Up @@ -153,7 +153,7 @@ func TestGitService_CreateCommit(t *testing.T) {
input := &Commit{
Message: String("Commit Message."),
Tree: &Tree{SHA: String("t")},
Parents: []Commit{{SHA: String("p")}},
Parents: []*Commit{{SHA: String("p")}},
}

mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestGitService_CreateSignedCommit(t *testing.T) {
input := &Commit{
Message: String("Commit Message."),
Tree: &Tree{SHA: String("t")},
Parents: []Commit{{SHA: String("p")}},
Parents: []*Commit{{SHA: String("p")}},
Verification: &SignatureVerification{
Signature: String(signature),
},
Expand Down Expand Up @@ -259,7 +259,7 @@ func TestGitService_CreateSignedCommitWithKey(t *testing.T) {
input := &Commit{
Message: String("Commit Message."),
Tree: &Tree{SHA: String("t")},
Parents: []Commit{{SHA: String("p")}},
Parents: []*Commit{{SHA: String("p")}},
SigningKey: keyring[0],
Author: &author,
}
Expand Down
6 changes: 3 additions & 3 deletions github/git_trees.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

// Tree represents a GitHub tree.
type Tree struct {
SHA *string `json:"sha,omitempty"`
Entries []TreeEntry `json:"tree,omitempty"`
SHA *string `json:"sha,omitempty"`
Entries []*TreeEntry `json:"tree,omitempty"`

// Truncated is true if the number of items in the tree
// exceeded GitHub's maximum limit and the Entries were truncated
Expand Down Expand Up @@ -125,7 +125,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(ctx context.Context, 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)

newEntries := make([]interface{}, 0, len(entries))
Expand Down
14 changes: 7 additions & 7 deletions github/git_trees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestGitService_GetTree(t *testing.T) {

want := Tree{
SHA: String("s"),
Entries: []TreeEntry{
Entries: []*TreeEntry{
{
Type: String("blob"),
},
Expand All @@ -59,7 +59,7 @@ func TestGitService_CreateTree(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

input := []TreeEntry{
input := []*TreeEntry{
{
Path: String("file.rb"),
Mode: String("100644"),
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestGitService_CreateTree(t *testing.T) {

want := Tree{
String("cd8274d15fa3ae2ab983129fb037999f264ba9a7"),
[]TreeEntry{
[]*TreeEntry{
{
Path: String("file.rb"),
Mode: String("100644"),
Expand All @@ -123,7 +123,7 @@ func TestGitService_CreateTree_Content(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

input := []TreeEntry{
input := []*TreeEntry{
{
Path: String("content.md"),
Mode: String("100644"),
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestGitService_CreateTree_Content(t *testing.T) {

want := Tree{
String("5c6780ad2c68743383b740fd1dab6f6a33202b11"),
[]TreeEntry{
[]*TreeEntry{
{
Path: String("content.md"),
Mode: String("100644"),
Expand All @@ -189,7 +189,7 @@ func TestGitService_CreateTree_Delete(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

input := []TreeEntry{
input := []*TreeEntry{
{
Path: String("content.md"),
Mode: String("100644"),
Expand Down Expand Up @@ -232,7 +232,7 @@ func TestGitService_CreateTree_Delete(t *testing.T) {

want := Tree{
String("5c6780ad2c68743383b740fd1dab6f6a33202b11"),
[]TreeEntry{
[]*TreeEntry{
{
Path: String("content.md"),
Mode: String("100644"),
Expand Down
4 changes: 2 additions & 2 deletions github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Issue struct {
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitempty"`
User *User `json:"user,omitempty"`
Labels []Label `json:"labels,omitempty"`
Labels []*Label `json:"labels,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Comments *int `json:"comments,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
Expand All @@ -55,7 +55,7 @@ type Issue struct {

// TextMatches is only populated from search results that request text matches
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
TextMatches []TextMatch `json:"text_matches,omitempty"`
TextMatches []*TextMatch `json:"text_matches,omitempty"`

// ActiveLockReason is populated only when LockReason is provided while locking the issue.
// Possible values are: "off-topic", "too heated", "resolved", and "spam".
Expand Down
2 changes: 1 addition & 1 deletion github/issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestIssuesService_Get(t *testing.T) {

want := &Issue{
Number: Int(1),
Labels: []Label{{
Labels: []*Label{{
URL: String("u"),
Name: String("n"),
Color: String("c"),
Expand Down
2 changes: 1 addition & 1 deletion github/migrations_source_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type Import struct {
// When the importer finds several projects or repositories at the
// provided URLs, this will identify the available choices. Call
// UpdateImport with the selected Import value.
ProjectChoices []Import `json:"project_choices,omitempty"`
ProjectChoices []*Import `json:"project_choices,omitempty"`
}

func (i Import) String() string {
Expand Down
4 changes: 2 additions & 2 deletions github/pulls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,15 @@ func TestPullRequestsService_ListCommits(t *testing.T) {
want := []*RepositoryCommit{
{
SHA: String("3"),
Parents: []Commit{
Parents: []*Commit{
{
SHA: String("2"),
},
},
},
{
SHA: String("2"),
Parents: []Commit{
Parents: []*Commit{
{
SHA: String("1"),
},
Expand Down
2 changes: 1 addition & 1 deletion github/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type Repository struct {

// TextMatches is only populated from search results that request text matches
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
TextMatches []TextMatch `json:"text_matches,omitempty"`
TextMatches []*TextMatch `json:"text_matches,omitempty"`
}

func (r Repository) String() string {
Expand Down
24 changes: 12 additions & 12 deletions github/repos_commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ import (
// Note that it's wrapping a Commit, so author/committer information is in two places,
// but contain different details about them: in RepositoryCommit "github details", in Commit - "git details".
type RepositoryCommit struct {
NodeID *string `json:"node_id,omitempty"`
SHA *string `json:"sha,omitempty"`
Commit *Commit `json:"commit,omitempty"`
Author *User `json:"author,omitempty"`
Committer *User `json:"committer,omitempty"`
Parents []Commit `json:"parents,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
URL *string `json:"url,omitempty"`
CommentsURL *string `json:"comments_url,omitempty"`
NodeID *string `json:"node_id,omitempty"`
SHA *string `json:"sha,omitempty"`
Commit *Commit `json:"commit,omitempty"`
Author *User `json:"author,omitempty"`
Committer *User `json:"committer,omitempty"`
Parents []*Commit `json:"parents,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
URL *string `json:"url,omitempty"`
CommentsURL *string `json:"comments_url,omitempty"`

// Details about how many changes were made in this commit. Only filled in during GetCommit!
Stats *CommitStats `json:"stats,omitempty"`
// Details about which files, and how this commit touched. Only filled in during GetCommit!
Files []CommitFile `json:"files,omitempty"`
Files []*CommitFile `json:"files,omitempty"`
}

func (r RepositoryCommit) String() string {
Expand Down Expand Up @@ -78,9 +78,9 @@ type CommitsComparison struct {
BehindBy *int `json:"behind_by,omitempty"`
TotalCommits *int `json:"total_commits,omitempty"`

Commits []RepositoryCommit `json:"commits,omitempty"`
Commits []*RepositoryCommit `json:"commits,omitempty"`

Files []CommitFile `json:"files,omitempty"`
Files []*CommitFile `json:"files,omitempty"`

HTMLURL *string `json:"html_url,omitempty"`
PermalinkURL *string `json:"permalink_url,omitempty"`
Expand Down
12 changes: 6 additions & 6 deletions github/repos_commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
Committer: &User{
Login: String("l"),
},
Parents: []Commit{
Parents: []*Commit{
{
SHA: String("s"),
},
Expand All @@ -106,7 +106,7 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
Deletions: Int(4),
Total: Int(108),
},
Files: []CommitFile{
Files: []*CommitFile{
{
Filename: String("f"),
Additions: Int(10),
Expand Down Expand Up @@ -358,7 +358,7 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
},
Author: &User{Login: String("l")},
Committer: &User{Login: String("l")},
Parents: []Commit{
Parents: []*Commit{
{
SHA: String("s"),
},
Expand All @@ -368,22 +368,22 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
AheadBy: Int(1),
BehindBy: Int(2),
TotalCommits: Int(1),
Commits: []RepositoryCommit{
Commits: []*RepositoryCommit{
{
SHA: String("s"),
Commit: &Commit{
Author: &CommitAuthor{Name: String("n")},
},
Author: &User{Login: String("l")},
Committer: &User{Login: String("l")},
Parents: []Commit{
Parents: []*Commit{
{
SHA: String("s"),
},
},
},
},
Files: []CommitFile{
Files: []*CommitFile{
{
Filename: String("f"),
},
Expand Down
Loading