MCPcopy Create free account
hub / github.com/cli/cli / CanPushToRepo

Function CanPushToRepo

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

Source from the content-addressed store, hash-verified

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