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

Function CanPushToRepo

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

Source from the content-addressed store, hash-verified

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