MCPcopy Index your code
hub / github.com/google/go-github / GetCommit

Method GetCommit

github/git_commits.go:88–102  ·  view source on GitHub ↗

GetCommit fetches the Commit object for a given SHA. GitHub API docs: https://docs.github.com/rest/git/commits?apiVersion=2022-11-28#get-a-commit-object meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha}

(ctx context.Context, owner, repo, sha string)

Source from the content-addressed store, hash-verified

86//
87//meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha}
88func (s *GitService) GetCommit(ctx context.Context, owner, repo, sha string) (*Commit, *Response, error) {
89 u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha)
90 req, err := s.client.NewRequest(ctx, "GET", u, nil)
91 if err != nil {
92 return nil, nil, err
93 }
94
95 var c *Commit
96 resp, err := s.client.Do(req, &c)
97 if err != nil {
98 return nil, resp, err
99 }
100
101 return c, resp, nil
102}
103
104// createCommit represents the body of a CreateCommit request.
105type createCommit struct {

Callers 5

pushCommitFunction · 0.45
updateFromGithubMethod · 0.45
TestGitService_GetCommitFunction · 0.45

Calls 2

NewRequestMethod · 0.80
DoMethod · 0.45