diff --git a/api/queries_repo.go b/api/queries_repo.go index c8ba31348..22d42cfbb 100644 --- a/api/queries_repo.go +++ b/api/queries_repo.go @@ -84,6 +84,9 @@ func GitHubRepo(client *Client, repo ghrepo.Interface) (*Repository, error) { hasIssuesEnabled description viewerPermission + defaultBranchRef { + name + } } }` variables := map[string]interface{}{ diff --git a/command/pr.go b/command/pr.go index 3f78d2340..464894c22 100644 --- a/command/pr.go +++ b/command/pr.go @@ -526,7 +526,6 @@ func prMerge(cmd *cobra.Command, args []string) error { if err != nil { return nil } - } var action string @@ -551,7 +550,7 @@ func prMerge(cmd *cobra.Command, args []string) error { fmt.Fprintf(colorableOut(cmd), "%s %s pull request #%d\n", utils.Magenta("✔"), action, pr.Number) if deleteBranch { - repo, err := convertRepoInterfaceToRepository(ctx, baseRepo) + repo, err := api.GitHubRepo(apiClient, baseRepo) if err != nil { return err } diff --git a/command/root.go b/command/root.go index 48c9b50ed..6233be957 100644 --- a/command/root.go +++ b/command/root.go @@ -249,30 +249,6 @@ func determineBaseRepo(apiClient *api.Client, cmd *cobra.Command, ctx context.Co return baseRepo, nil } -func convertRepoInterfaceToRepository(ctx context.Context, repo ghrepo.Interface) (*api.Repository, error) { - apiClient, err := apiClientForContext(ctx) - if err != nil { - return nil, err - } - - remotes, err := ctx.Remotes() - if err != nil { - return nil, err - } - - repoContext, err := context.ResolveRemotesToRepos(remotes, apiClient, "") - if err != nil { - return nil, err - } - - baseRepo, err := repoContext.BaseRepo() - if err != nil { - return nil, err - } - - return baseRepo, nil -} - func rootHelpFunc(command *cobra.Command, s []string) { if command != RootCmd { cobraDefaultHelpFunc(command, s)