usethis icon indicating copy to clipboard operation
usethis copied to clipboard

`pr_finish()` when the remote tracking branch has already been deleted

Open jennybc opened this issue 1 year ago • 0 comments

I just did a pr_finish() on an external PR that was closed unmerged, but that I had explored with pr_fetch(). The contributor had already deleted the associated branch, after my pr_fetch() but before my pr_finish(). pr_finish() dies with this error:

Error in libgit2::git_remote_fetch : unexpected http status code: 404

and it happens here:

https://github.com/r-lib/usethis/blob/29062553a7d1ce3f0dcc73c24a3eb13c8600205b/R/pr.R#L563-L566

This early exit means we don't switch back to default branch, pull from source repo, delete the local PR branch, remove the temporary PR remote.

Should pr_finish() be able to carry-on in this scenario and still do all that other cleanup? I suspect so.

jennybc avatar Sep 01 '22 15:09 jennybc