Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Adding error handling to git_remote http requests (Resolves #625) #628

Merged
merged 6 commits into from Jul 9, 2021

Conversation

dgkf
Copy link
Contributor

@dgkf dgkf commented Jun 16, 2021

Addressing #625

  • Simple error handling, returning NA if either the download or DESCRIPTION parsing fails.
  • Tests for a gitlab repo and an inaccessible repo (just given a fake url) to simulate an http endpoint behind authentication. (had to test to make sure the only warnings that get emitted are from remote_sha since it's not a real git url, but otherwise tests the http recovery).

Happy to iterate from here, but felt it was simple enough to just get the ball rolling on it.

Copy link
Contributor

@niheaven niheaven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

R/install-git.R Outdated
download(tmp, url)
read_dcf(tmp)$Package
}, error = function(e) {
NA_character_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NA_character_
return(NA_character_)

Yes I know that will just return 😄 But let's make it clear~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we don't put explicit returns except for early returns. See https://style.tidyverse.org/functions.html#return for details.

@jimhester
Copy link
Member

Thanks @dgkf for the PR and @niheaven for reviewing.

@dgkf if you could add a note to the NEWS I can merge this.

@dgkf
Copy link
Contributor Author

dgkf commented Jun 16, 2021

Should be good to go - I just added a note to @niheaven's description of the HTTP changes. I felt that an additional NEWS entry would be unclear since it only pertains to new features in the upcoming release. Let me know if you'd prefer that it's a separate entry and I can split it out.

@niheaven
Copy link
Contributor

@dgkf Maybe a separate entry is preferred, since my PR has already been merged into 2.4.0, and this PR sould be there in next version.

@dgkf
Copy link
Contributor Author

dgkf commented Jun 22, 2021

Thanks @niheaven - mistake on my part. Didn't realize that code was already in a release. I reverted my edits and broke out the NEWS entry into the dev section.

@dgkf
Copy link
Contributor Author

dgkf commented Jun 25, 2021

As far as I can tell, any errors on windows builds are hold overs from issues on current master. Let me know if there's anything more that you'd like me to address.

@hokkwan
Copy link

hokkwan commented Jul 8, 2021

I hope this PR can be incorporated soon, because this also resolves the issue regarding installing packages from Git repositories on AzureDevOps, see issue #621.

@jimhester jimhester merged commit 37f5c96 into r-lib:master Jul 9, 2021
@jimhester
Copy link
Member

Hey! Thanks!

Thanks @dgkf for working on this PR and for @niheaven for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants