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

Function RepoDefaultBranch

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

Source from the content-addressed store, hash-verified

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