diff --git a/command/pr_diff.go b/command/pr_diff.go index c39c491a4..22217b35b 100644 --- a/command/pr_diff.go +++ b/command/pr_diff.go @@ -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) diff --git a/command/pr_lookup.go b/command/pr_lookup.go index 48cd824ff..7f169ff77 100644 --- a/command/pr_lookup.go +++ b/command/pr_lookup.go @@ -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) {