Allow pr status -R <repo> usage from outside of a git repo
This commit is contained in:
parent
e80c2f852d
commit
bec667964c
1 changed files with 4 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue