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

Support providing a git link when publishing a crate #2640

Closed
larsbergstrom opened this issue May 3, 2016 · 6 comments
Closed

Support providing a git link when publishing a crate #2640

larsbergstrom opened this issue May 3, 2016 · 6 comments
Labels
A-vcs Area: general VCS issues Command-publish S-triage Status: This issue is waiting on initial triage.

Comments

@larsbergstrom
Copy link

In order to support cargo clone (#1545) or any cargo vendor solution where the project has a crates.io reference, we will need to discover the git link in order to make a local clone of the repository.

It would be great if we could either put these in Cargo.toml and have them available in the published crate or (even better!) push the metadata up automagically during cargo publish, since there's a bit of a chicken-and-egg problem of needing to have the hash but not having the hash until the change is committed :-) Also open to other solutions, since we've discussed this need in the past and one of you might already have thought about something even smoother.

cc @alexcrichton @wycats

@steveklabnik
Copy link
Member

Is this different than the repository key? Is it that that key is http, but this would be git?

@larsbergstrom
Copy link
Author

@steveklabnik We need the hash in order to make a useful clone. As-is, the repository link isn't terribly useful unless it happens to point to a repository that has some kind of tagging that matches semver and the crate has decided to use it every time they cargo publish.

@alexcrichton
Copy link
Member

To me this is closely related to #841. We won't actually ever have a method of 100% attributing a publish to a git hash (because we can't be sure you pushed it up), but we can at least do things like:

  • Ensure the index has no unstaged changes
  • Ensure all changes are committed
  • Ensure the commit itself is pushed

Once we have all that then we could record the SHA the commit happened at. Sounds like something plausible Cargo should do!

@luser
Copy link
Contributor

luser commented Jun 8, 2016

I'd like to have this data so that we could figure out a way to persist it into crash reports, to link to the source repo at the right revision. This is not as important for Gecko, where everything will be vendored, but will be useful if we wire up crash reporting in Servo or some other project that pulls in deps from crates.io.

@kornelski
Copy link
Contributor

I need a similar thing - I'd like to check whether source code of a published create matches its git repository, but there's no explicit connection between crate on crates.io and git repository revision.

I think making a note of the current git hash at time of publishing will be good enough (in the Cargo.toml copy unloaded to crates.io) In the worst case if the code isn't published or is rebased it won't match anything.

@epage epage added A-vcs Area: general VCS issues S-triage Status: This issue is waiting on initial triage. labels Sep 28, 2023
@epage
Copy link
Contributor

epage commented Nov 22, 2024

This sounds like .cargo_vcs_info.json which was added in #5886 and expanded in #13695.

Closing in favor of that work. If there is a reason we need to keep this open, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vcs Area: general VCS issues Command-publish S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

6 participants