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

Function RepoDefaultBranch

api/queries_repo.go:415–425  ·  view source on GitHub ↗
(client *Client, repo ghrepo.Interface)

Source from the content-addressed store, hash-verified

413}
414
415func RepoDefaultBranch(client *Client, repo ghrepo.Interface) (string, error) {
416 if r, ok := repo.(*Repository); ok && r.DefaultBranchRef.Name != "" {
417 return r.DefaultBranchRef.Name, nil
418 }
419
420 r, err := GitHubRepo(client, repo)
421 if err != nil {
422 return "", err
423 }
424 return r.DefaultBranchRef.Name, nil
425}
426
427func CanPushToRepo(httpClient *http.Client, repo ghrepo.Interface) (bool, error) {
428 if r, ok := repo.(*Repository); ok && r.ViewerPermission != "" {

Callers 7

parseSectionFunction · 0.92
syncLocalRepoFunction · 0.92
executeRemoteRepoSyncFunction · 0.92
closeRunFunction · 0.92
checkoutRunFunction · 0.92
runViewFunction · 0.92
runRunFunction · 0.92

Calls 1

GitHubRepoFunction · 0.85

Tested by

no test coverage detected