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

Function CanPushToRepo

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

Source from the content-addressed store, hash-verified

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