MCPcopy
hub / github.com/cli/cli / RepoDefaultBranch

Function RepoDefaultBranch

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

Source from the content-addressed store, hash-verified

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