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

Function RepoDefaultBranch

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

Source from the content-addressed store, hash-verified

410}
411
412func RepoDefaultBranch(client *Client, repo ghrepo.Interface) (string, error) {
413 if r, ok := repo.(*Repository); ok && r.DefaultBranchRef.Name != "" {
414 return r.DefaultBranchRef.Name, nil
415 }
416
417 r, err := GitHubRepo(client, repo)
418 if err != nil {
419 return "", err
420 }
421 return r.DefaultBranchRef.Name, nil
422}
423
424func CanPushToRepo(httpClient *http.Client, repo ghrepo.Interface) (bool, error) {
425 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