-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow non-master branch for alternative registry index to facilitate development and testing #7329
Comments
Hey! I'm kind of new to the Rust community. I'm interested in learning more about it and making contributions, so I see this as kind of low-priority low-hanging fruit. Maybe this feature could prove more valuable especially considering how GitHub and other git hosting platforms have recently changed the default branch name from "master" to "main", etc... As long as the implementing code won't just be a nuisance subject to bitrot, I'd be happy to submit a PR! |
Thank you for asking before submitting a PR. As you may have noticed we have a lot of feature-request issues and have not come to decisions about most of them. I personally wouldn't mind seeing a PR for this. Others know that part of the code base better than I so may have stronger opinions and suggestions for how to start. |
Hi, @xeyler did you have any chance to try to work on this? I think the same and maybe I could help somehow? |
Hey, synek! I haven't put a lot of time into this one yet. Although, I have been spending a little more time with Rust. I'm thinking I'll try to find the time to create a PR soon. Unfortunately, I'm not sure how this sort of job could be segmented into a project which multiple people could work on. If you have suggestions, I'd love to hear them! I'll try to keep you posted as I find time to draft a PR. |
Does anyone mind if I start working on this? It seems that it did not receive much track and after exploring a bit, I am now rather confident on how to implement this. |
Hey @snawaz! I began implementing it, but I found myself in a tricky spot I had not foreseen: I wanted to try extending the feature to allow specifying the reference not only with a However, all of this was just me thinking it might be a good idea to add the possibility for these Thanks in advance! |
The API is not stable, the version number goes up every release. So make the changes you need. |
Nope. |
@snawaz Oh yes, I was thinking about the downloading of dependencies which could use immobile references but not the publishing of new versions which does need a branch. Thanks for the clarification. |
@snawaz Considering how registries work using a defined Web API, we do agree that the current |
Not sure if I understood your doubts or concerns. Anyway, here are my thoughts:
|
You understood them well, thanks! This means that in order to produce an MVP, I currently aim only Cargo's |
Personally I feel it would be very useful if you could point it to commits as well as branches. In fact, often I clone the registry on purpose so that I can recreate a lost Cargo.lock file. It would be much nicer if you could just point it to a custom commit directly. |
How is it going to work? Let's imagine it points to a "commit".
How role does the "commit" play here? Every time you publish a crate, the HEAD changes. So what does the "commit" ensure in such cases? |
@snawaz the fact that you explicitly point to a commit means that you don't pick up any new crate versions published since then. This is useful in some scenarios, e.g. when you ran cargo update locally and it broke your build but you don't have Cargo.lock in git, but you maybe know when you ran cargo update last time, so you check out the old state. |
I didn't get that. What does "pick up" mean? Are you referring to "resolving to crates versions published after the commit"? If so, then you're talking about an entirely different thing here, and it's not in the line of supporting a different branch for the registry for normal operations like publish and download. |
From a technical point of view it's not different at all. |
Not different from what? And what technical point of view? You also did not answer the questions I asked, neither did you explain the confusions as to what exactly you mean. |
|
By setting the commit revision instead of a branch name.
You might remember a general date or so when you last made cargo update. You can then obtain a commit hash from that date using github or such. |
If you have not committed your
BTW, if you break your |
publish is the only command that has issues with hardcoded commits. All other commands don't have any issues.
It's still officially recommended that you don't commit your Cargo.lock in library projects. This has nothing to do with seriousness. This has something to do with control over the process. Right now there is little control for users. |
For those of us running internal mirrors of the crates.io registry, being able to specify a branch so that I can easily sync the crates index and add my custom commit to config.json on a branch that doesn't conflict with upstream names would be quite handy. |
Now that Cargo alternative registries have been stabilized, they are configured as:
Currently, Cargo uses the
master
branch by default, which makes development & testing difficult as it interferes with the master which is used in the production. So it'd be good if Cargo allows us to usenon-master
branch as well:where
branch
could be an optional field whose default value ismaster
to be backward-compatible.The text was updated successfully, but these errors were encountered: