Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pr_push() with a repo with no-pr yields "Error in prs[[1]]: subscript out of bounds" #990

Closed
maurolepore opened this issue Jan 29, 2020 · 0 comments

Comments

@maurolepore
Copy link
Contributor

I expected pr_push() to be able to push a new pull request to a repo with no previous pr (e.g. https://github.com/maurolepore/with-no-pr). But instead I get "Error in prs[[1]]: subscript out of bounds".

The problem seems to be in pr_find(). It correctly returns character() with a new pr to a repo with some pr (e.g. https://github.com/maurolepore/with-some-pr). But errors if the new pr is to a repo with no previous pr.

# Ok
usethis:::pr_find("maurolepore", repo = "with-some-pr", pr_branch = "new")
#> character(0)

# Fails
usethis:::pr_find("maurolepore", repo = "with-no-pr", pr_branch = "new")
#> Error in prs[[1]]: subscript out of bounds

Created on 2020-01-29 by the reprex package (v0.3.0.9001)

cc' @uni-sabia

maurolepore added a commit to maurolepore/usethis that referenced this issue Jan 29, 2020
Fixes r-lib#990

The is the  minimal fix, maybe too terse. A more expressive
solution comes in a separate commit, to allow reverting it if you
prefer the shorter solution.

The tests will also come in a separate commit because they test
the internal `pr_find()` instead of the exported `pr_push()`. You
may want to revert that upcomming commit too.
maurolepore added a commit to maurolepore/usethis that referenced this issue Jan 29, 2020
maurolepore added a commit to maurolepore/usethis that referenced this issue Jan 29, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant