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

Introduce a github spesific path in HEAD resolution for forc-pkg #6026

Open
kayagokalp opened this issue May 16, 2024 · 0 comments
Open

Introduce a github spesific path in HEAD resolution for forc-pkg #6026

kayagokalp opened this issue May 16, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request forc-pkg Everything related to the `forc-pkg` crate.

Comments

@kayagokalp
Copy link
Member

Currently one of the biggest slowdown we see in forc-pkg happens (after the cold run which fetches std) is resolution of commit hash of tag's HEAD. This is done to check if the local copy of the dependency can be used which is cached by the commit hash. So in each forc build we make a shallow fetch using git2-rs. This shallow fetching although helping, is still a little slow with sway repo itself. Now the main reason we are using git to do this is because we want to be provider agnostic. Meaning that we are not locked to github but also fetch from bitbucket etc. Now i believe most of our dependencies will happen to be on github and we can add a specical case which checks if the git source is coming from github. If that is the case we can get the commit hash of particular tag with an API call.

ex:
https://api.github.com/repos/FuelLabs/sway/git/ref/tags/v0.58.0

This will enables us to quickly start searching local, instead of spending time to do shallow fetching of the sway repo. If this fails, or the source is from another provider, we can fallback into the current method.

Note: we need to do this commit checking for the current tag each time since it is possible that a tag is created and then deleted, re-created etc. So we cannot cache this completely while covering all edge cases but we can fetch it faster via the api for github packages.

@kayagokalp kayagokalp added enhancement New feature or request forc-pkg Everything related to the `forc-pkg` crate. labels May 16, 2024
@kayagokalp kayagokalp self-assigned this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forc-pkg Everything related to the `forc-pkg` crate.
Projects
None yet
Development

No branches or pull requests

1 participant