Skip to content

Commit 46a1e3c

Browse files
committed
Remove convertRepoInterfaceToRepository
1 parent 5d99c56 commit 46a1e3c

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

api/queries_repo.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ func GitHubRepo(client *Client, repo ghrepo.Interface) (*Repository, error) {
8484
hasIssuesEnabled
8585
description
8686
viewerPermission
87+
defaultBranchRef {
88+
name
89+
}
8790
}
8891
}`
8992
variables := map[string]interface{}{

command/pr.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ func prMerge(cmd *cobra.Command, args []string) error {
526526
if err != nil {
527527
return nil
528528
}
529-
530529
}
531530

532531
var action string
@@ -551,7 +550,7 @@ func prMerge(cmd *cobra.Command, args []string) error {
551550
fmt.Fprintf(colorableOut(cmd), "%s %s pull request #%d\n", utils.Magenta("✔"), action, pr.Number)
552551

553552
if deleteBranch {
554-
repo, err := convertRepoInterfaceToRepository(ctx, baseRepo)
553+
repo, err := api.GitHubRepo(apiClient, baseRepo)
555554
if err != nil {
556555
return err
557556
}

command/root.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -249,30 +249,6 @@ func determineBaseRepo(apiClient *api.Client, cmd *cobra.Command, ctx context.Co
249249
return baseRepo, nil
250250
}
251251

252-
func convertRepoInterfaceToRepository(ctx context.Context, repo ghrepo.Interface) (*api.Repository, error) {
253-
apiClient, err := apiClientForContext(ctx)
254-
if err != nil {
255-
return nil, err
256-
}
257-
258-
remotes, err := ctx.Remotes()
259-
if err != nil {
260-
return nil, err
261-
}
262-
263-
repoContext, err := context.ResolveRemotesToRepos(remotes, apiClient, "")
264-
if err != nil {
265-
return nil, err
266-
}
267-
268-
baseRepo, err := repoContext.BaseRepo()
269-
if err != nil {
270-
return nil, err
271-
}
272-
273-
return baseRepo, nil
274-
}
275-
276252
func rootHelpFunc(command *cobra.Command, s []string) {
277253
if command != RootCmd {
278254
cobraDefaultHelpFunc(command, s)

0 commit comments

Comments
 (0)