From bec667964c6e4fbac8d30694cca85bc630207f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 18 Mar 2020 14:13:17 +0100 Subject: [PATCH] Allow `pr status -R ` usage from outside of a git repo --- command/pr.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command/pr.go b/command/pr.go index e1c8e796b..e9547d067 100644 --- a/command/pr.go +++ b/command/pr.go @@ -81,8 +81,9 @@ func prStatus(cmd *cobra.Command, args []string) error { return err } + repoOverride, _ := cmd.Flags().GetString("repo") currentPRNumber, currentPRHeadRef, err := prSelectorForCurrentBranch(ctx, baseRepo) - if err != nil { + if err != nil && repoOverride == "" { return err } @@ -100,6 +101,8 @@ func prStatus(cmd *cobra.Command, args []string) error { printHeader(out, "Current branch") if prPayload.CurrentPR != nil { printPrs(out, 0, *prPayload.CurrentPR) + } else if currentPRHeadRef == "" { + printMessage(out, " There is no current branch") } else { message := fmt.Sprintf(" There is no pull request associated with %s", utils.Cyan("["+currentPRHeadRef+"]")) printMessage(out, message)