-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add support for alternative default branches in GitHub #508
Comments
I think this would be a non-starter unless you can implement it only using the existing number of GitHub API calls, we already run into API limiting problems with the current number of calls, so we can't really do an additional call to lookup the default branch. If you can work out a way to do this reusing the same number of API calls we could review a pull request for it. |
Might be possible with the graphql api. |
I don't know how far reaching this is inside the inner workings of Running
For example: Why not just change the default value for |
Are you sure? It does not for me: > remotes::install_github("gaborcsardi/secret", ref = "")
Error: Failed to install 'unknown package' from GitHub:
HTTP error 404.
No commit found for the ref
Did you spell the repo owner (`gaborcsardi`) and repo name (`secret`) correctly?
- If spelling is correct, check that you have the required permissions to access the repo. |
Yes, I see the problem now. There is also the Setting But again, the url created within the e.g. So a quick I think the next issue would probably be However, the No reference: Someone more versed in Again, no extra API calls. I imagine most other calls to github/git could have something like this around it (and presumably for others in the |
Currently, |
It seems like
|
That makes perfect sense. I've just double checked and all the links I've posted earlier work using Documentation for |
using |
Hi, I'm sorry if this has already have been discussed, and it could be that it is the implicit assumption, but I don't see where it says that I have designed all my GitHub repositories based on the fact that
Changing the behavior of If I had a vote/say, and this is about migrating away from the branch name |
Can you implement a fallback with a single GH API query and base R? The other issue is that I agree that this will break some people's workflows. However, I am fairly sure that for most R package repos the default branch and the current remotes default is the same, and they won't experience any disruptions. We will also give them the freedom to name their default branch however they want. |
Righty-oh. Thanks for confirming the design decision. One more though, would it be possible to give the maintainer control over this via a config file in the repos? For example, $ cat .remotes.yml
defaults:
- ref=main Or, by hijacking some existing file for the same purpose. The downside would be one-more round trip. The upside would be giving the maintainer full control of what end users install when they don't specify Just a thought. Not a biggy but certainly an itch. |
I am afraid I don't quite understand. Where would you put that file, and which packages would it apply to? |
Sorry for not being clear. I'd put it in the root of my repos. Just like .travis.yml etc. |
Another thought would be a field in the DESCRIPTION file |
Yes, but then what does it apply to? To the repo itself? So we would first download That's another round of queries again, and it also complicates the process substantially. Isn't it just easier to make the branch that you want people to download the default? That's also what they see on the main repo page, shouldn't they get exactly that when they run |
Yes.
I think we discussed this elsewhere: In short, I want the default to be the develop branch (for PRs and visibility) and master the most recent stable release (for installs). Long argument: We don't have a standard for release branches or tags, so |
It's an interesting way to deal with your branches that I'd never really considered. Not quite as much of an edge-case as I had originally assumed. From your explanation it actually sounds like a really good workflow. The problem is you essentially want two different "defaults". The one as applied by git/GitHub and From what I gather, it seems like the creators of Your use-case (as reasonable as it seems) is kinda exploiting a loop-hole in A solution (and unfortunately, it would probably take some work to setup in your workflow) would be to use a second account for stable releases vs development versions. Commits have three levels: I know this isn't ideal for you or anybody else that uses this kind of workflow, but I'm fairly sure this change is going to have to happen at some point (sooner or later I don't know), so it's something to consider. |
In understand that the using the default branch will be a convenient solution to the upcoming change. Note that there is a bigger discussion here: In my own work, I've already have instructions how to install from the development branch In this bigger picture there is also the support for declaring dependencies in the
This is not stable or safe because what's installed there can change second by second (contrary to stable releases on CRAN/Bioconductor). I argue each package maintainer should provide a stable release branch so that others can always point to that one. This is the only way we can guarantee some kind of stability outside of CRAN/Bioconductor releases. Something like:
This is a standard that only the My suggestion of having a
that the package maintainer can control. This would require an extra roundtrip in those cases, i.e. This would actually be useful for some other repositories where their In summary: This might be a good time to think through the long-term role of PS. Does the changes proposed here, including the |
For what it's worth, I wonder if the behavior that @HenrikBengtsson is looking for would be better served by using the special |
I think this is a good point - checking off consistency across the API is important.
This is actually a model I'm using right now. My current stable release is the (HEAD of) It's on my to do list to learn how to do proper '*release' releases - I think it was @gaborcsardi who pointed this out to me. I'd sign up on making new default would be |
I also like this idea. It would require more information regarding github releases taught from an R perspective. It would also require that |
Changing to installing releases by default is not possible, as it would break tons of code. The goal of remotes and My personal view is that the main use case of I completely agree that people should not install dev versions of packages by default. E.g. I removed the instructions for installing dev versions from the READMEs of all my packages. I also think that the right tools for distributing R packages are CRAN and CRAN-like repositories. |
@MyKo101 for info since you mention devtools, regarding GitHub releases, there's |
FYI, the remote
|
@HenrikBengtsson FWIW This averts the problem you mention of not being able to track down which bleeding-edge install a user may be using when installing from IIUC to do this My 2 cents is if you're installing with
|
Not at all. :) No extra work is needed, remotes adds the git sha automatically if you install from git, GitHub, etc. > remotes::install_github("r-lib/cli")
[...]
> packageDescription("cli")$RemoteSha
[1] "e3ca34656f5bb82df63bfc1c741e75acc79b13d9" > library(cli)
> sessioninfo::session_info()
- Session info ---------------------------------------------------------------
[...]
- Packages -------------------------------------------------------------------
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0)
cli * 2.0.2.9000 2020-06-22 [1] Github (r-lib/cli@e3ca346)
crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.0)
fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.0)
glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.0)
remotes 2.1.1.9000 2020-06-18 [1] Github (r-lib/remotes@9b5dc29)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0)
withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.0)
[1] C:/Users/csard/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.1/library
Again, the purpose of |
Should this be closed with the new merges? |
Closed by #510 |
remotes::install_github()
assumes that the default branch is named "master", which is not always the case, e.g.Created on 2020-06-13 by the reprex package (v0.3.0)
The GitHub API notes a
default_branch
field that could provide this information, e.g.:Created on 2020-06-13 by the reprex package (v0.3.0)
So, I think this can be a drop-in for the default value for the
ref
argument ininstall_github
. Some additional re-factoring might be needed if we wanted to bundle the GitHub API calls.Note, to my knowledge, this issue was first reported by @elizagrames on twitter, and we chatted about a potential fix before writing up this issue. We're happy to work on a PR to this, and look into propagating the solution to other
install_*
functions, if so desired.The text was updated successfully, but these errors were encountered: