Skip to content

Commit 6b655ec

Browse files
committed
Protect against "no PR identified"
Without this, if the PR branch has been deleted, you see this ("Finishing PR<>"): > pr_finish() ℹ Finishing PR <> ! Local branch "r-wd-use-forward-slash" has no associated remote branch. ℹ If we delete "r-wd-use-forward-slash", any work that exists only on this branch may be hard for you to recover.
1 parent f8a7bb7 commit 6b655ec

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

R/pr.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,13 @@ pr_clean <- function(
574574
} else {
575575
pr <- pr_get(number = number, tr = tr)
576576
}
577-
ing <- switch(mode, finish = "Finishing", forget = "Forgetting")
578-
ui_bullets(c(
579-
"i" = "{ing} PR {.href [{pr$pr_string}]({pr$pr_html_url})}"
580-
))
577+
578+
if (!is.null(pr)) {
579+
ing <- switch(mode, finish = "Finishing", forget = "Forgetting")
580+
ui_bullets(c(
581+
"i" = "{ing} PR {.href [{pr$pr_string}]({pr$pr_html_url})}"
582+
))
583+
}
581584

582585
pr_local_branch <- if (is.null(pr)) git_branch() else pr$pr_local_branch
583586

0 commit comments

Comments
 (0)