-
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
Update a Github dependency with --precise <short_id>
fails
#13188
Comments
Digging into the code, I see this completion with Could the regression come from #12849 ? |
Good finding! Thank you. I've tested several toolchains. Starting from 1.46.0 Cargo contains this bug, which contains the PR #8363 that you observed the potential bad commit. The Cargo started using cargo/src/cargo/sources/git/source.rs Lines 35 to 37 in ddc2799
The zero-padding behavior is a documented behavior in libgit2 like from the beginning, so not a dependency issue. It might or might not be GitHub has changed the API. I cannot tell, as Cargo had no such a test exercising Feel like |
I will provide a PR to fix it based on this
This is worth a look, I will check the relevant code by the way, once there is any feasible plan I will make a corresponding plan @rustbot claim |
If possible I would like to still have the possibility to use As a use case in Zenoh: there are some plugins (shared libraries) for which the dependency to the I think a solution could be the following:
I tested such a patch here, and it seems to work. |
Thanks for looking into the issue! The effort is much appreciated :) However, there are probably two things we need to take care of:
That said, it doesn't mean we cannot support short hashes. We need to find a reliable way to pass down the value from |
Understood, that makes sense. I think the root of the issue is that the conversion from short SHA to I made some tests with git2: This call to An alternative is to retrieve the full SHA in |
Sorry, I haven't started this work yet. It's nice to see a better solution being proposed. 👍 |
Oops. I didn't realize this is claimed. Sorry for that, @linyihai 😔 Actually I was trying to provide guidance but ended up writing a fix |
The content to be changed is already very different from what I have been exposed to before, So feel free to continue it. Your PR is also a good guidance for me. |
You PR is more advanced than my proposal. I agree that having a |
Problem
Updating a Github dependency with a short commit id fails with such log:
Steps
cargo new test-cargo-precise cd test-cargo-precise cargo add --git https://github.com/rust-lang/regex regex CARGO_LOG=trace cargo update -p regex --precise 837fd85
Resulting
cargo update
log:Possible Solution(s)
No response
Notes
This Github API URL used by
cargo
returns an error:https://api.github.com/repos/rust-lang/regex/commits/837fd85000000000000000000000000000000000
While the same but with short commit id succeeds:
https://api.github.com/repos/rust-lang/regex/commits/837fd85
What's strange is that I successfully used such
cargo update -p <dep> --precise <short_id>
few weeks ago.Could it be that Github changed its API ?
Version
The text was updated successfully, but these errors were encountered: