Skip to content

Commit

Permalink
Make better use of branch knowledge we have on hand
Browse files Browse the repository at this point in the history
Maybe fixes r-lib#1331

Yeah, I'm hopeful enough that I will let this commit close that issue
  • Loading branch information
jennybc committed Feb 25, 2021
1 parent 012dac5 commit b55caa1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/pr.R
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ pr_clean <- function(number = NULL,
if (is.null(number)) {
check_pr_branch()
pr <- pr_find(git_branch(), tr = tr, state = "all")
# if the remote branch has already been deleted (probably post-merge), we
# can't always reverse engineer what the corresponding local branch was, but
# we already know it -- it's how we found the PR in the first place!
pr$pr_local_branch <- pr$pr_local_branch %|% git_branch()
} else {
pr <- pr_get(number = number, tr = tr)
}
Expand Down Expand Up @@ -699,7 +703,7 @@ pr_data_tidy <- function(pr) {
gbl <- gbl[!is.na(gbl$upstream), c("name", "upstream")]
gbl$upstream <- sub("^refs/remotes/", "", gbl$upstream)
m <- match(pr_remref, gbl$upstream)
out$pr_local_branch <- if (is.na(m)) NA else gbl$name[m]
out$pr_local_branch <- if (is.na(m)) NA_character_ else gbl$name[m]

# If the fork has been deleted, these are all NA
# - Because pr$head$repo is NULL:
Expand Down

0 comments on commit b55caa1

Please sign in to comment.