Skip to content

Commit bec6679

Browse files
committed
Allow pr status -R <repo> usage from outside of a git repo
1 parent e80c2f8 commit bec6679

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

command/pr.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ func prStatus(cmd *cobra.Command, args []string) error {
8181
return err
8282
}
8383

84+
repoOverride, _ := cmd.Flags().GetString("repo")
8485
currentPRNumber, currentPRHeadRef, err := prSelectorForCurrentBranch(ctx, baseRepo)
85-
if err != nil {
86+
if err != nil && repoOverride == "" {
8687
return err
8788
}
8889

@@ -100,6 +101,8 @@ func prStatus(cmd *cobra.Command, args []string) error {
100101
printHeader(out, "Current branch")
101102
if prPayload.CurrentPR != nil {
102103
printPrs(out, 0, *prPayload.CurrentPR)
104+
} else if currentPRHeadRef == "" {
105+
printMessage(out, " There is no current branch")
103106
} else {
104107
message := fmt.Sprintf(" There is no pull request associated with %s", utils.Cyan("["+currentPRHeadRef+"]"))
105108
printMessage(out, message)

0 commit comments

Comments
 (0)