MCPcopy
hub / github.com/cli/cli / CanPushToRepo

Function CanPushToRepo

api/queries_repo.go:423–434  ·  view source on GitHub ↗
(httpClient *http.Client, repo ghrepo.Interface)

Source from the content-addressed store, hash-verified

421}
422
423func CanPushToRepo(httpClient *http.Client, repo ghrepo.Interface) (bool, error) {
424 if r, ok := repo.(*Repository); ok && r.ViewerPermission != "" {
425 return r.ViewerCanPush(), nil
426 }
427
428 apiClient := NewClientFromHTTP(httpClient)
429 r, err := GitHubRepo(apiClient, repo)
430 if err != nil {
431 return false, err
432 }
433 return r.ViewerCanPush(), nil
434}
435
436// RepoParent finds out the parent repository of a fork
437func RepoParent(client *Client, repo ghrepo.Interface) (ghrepo.Interface, error) {

Callers

nothing calls this directly

Calls 3

NewClientFromHTTPFunction · 0.85
GitHubRepoFunction · 0.85
ViewerCanPushMethod · 0.80

Tested by

no test coverage detected