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 diffing against the original repo #18

Open
epage opened this issue Mar 27, 2024 · 4 comments
Open

Support diffing against the original repo #18

epage opened this issue Mar 27, 2024 · 4 comments

Comments

@epage
Copy link

epage commented Mar 27, 2024

The information is usually present.

For context for the use case, see https://rust-lang.zulipchat.com/#narrow/stream/318791-t-crates-io/topic/Link.20to.20where.20the.20sources.20of.20a.20crate.20are.20located.20in.20git/near/429819690

@xfbs
Copy link
Owner

xfbs commented Mar 28, 2024

I can look into this, it sounds like something that could be useful.

Just for my understanding: do you mean that diff.rs should diff a released version of a crate with the commit in git?

One idea I had was to be able to diff a released version of a crate vs a specific branch. As in: compare v0.3.1 vs master. But that sounds like a slightly different use-case to the one that you are describing.

@epage
Copy link
Author

epage commented Mar 28, 2024

Just for my understanding: do you mean that diff.rs should diff a released version of a crate with the commit in git?

Yes, particularly the commit used when publishing. On publish, cargo records

  • commit hash
  • path within repo

So long as the user set their repo in the metadata, we can diff against that commit. Diffing against tags and branches could also be nice; I just don't have as concrete of use cases for doing so.

@xfbs
Copy link
Owner

xfbs commented Mar 28, 2024

So, one way to get this done is:

  • parse the Cargo.toml in the diff version (left)
  • check if repository is in the metadata
  • in the right version dropdown, show an entry for git
  • if selected, attempt to fetch an archive of the commit (like https://github.com/$user/$repo/archive/aef66c462abe817e33aad91d97aa782a1e2ad2c7.tar.gz)
  • when doing the diff, have to account for the fact that the crate might live in a subfolder in the repo (in case of a cargo workspace)

@epage
Copy link
Author

epage commented Mar 28, 2024

Yes and for

when doing the diff, have to account for the fact that the crate might live in a subfolder in the repo (in case of a cargo workspace)

the vcs info contains that path

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

No branches or pull requests

2 participants