This commit is contained in:
Corey Johnson 2020-05-26 17:08:34 -07:00
parent 8d1f2745a4
commit 30eb2d3ad6
2 changed files with 3 additions and 6 deletions

View file

@ -42,9 +42,8 @@ func prDiff(cmd *cobra.Command, args []string) error {
}
pr, err := prFromArgs(ctx, baseRepo, args...)
if err != nil {
return err
return fmt.Errorf("could not find pull request: %w", err)
}
diff, err := apiClient.PullRequestDiff(baseRepo, pr.Number)

View file

@ -22,9 +22,8 @@ func prFromArgs(ctx context.Context, repo ghrepo.Interface, args ...string) (*ap
return prForCurrentBranch(ctx, repo)
}
prString := args[0]
// First check to see if the prString is a url
prString := args[0]
pr, err := prFromURL(ctx, repo, prString)
if pr != nil || err != nil {
return pr, err
@ -37,8 +36,7 @@ func prFromArgs(ctx context.Context, repo ghrepo.Interface, args ...string) (*ap
}
// Last see if it is a branch name
pr, err = api.PullRequestForBranch(apiClient, repo, "", prString)
return pr, err
return api.PullRequestForBranch(apiClient, repo, "", prString)
}
func prFromNumberString(ctx context.Context, repo ghrepo.Interface, s string) (*api.PullRequest, error) {