Support GitHub and GitLab URLs#7
Conversation
`ref/heads/<branch>` is only for branches and leaving it out supports either.
|
@race-of-sloths invite |
|
@SamuelSarle Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: executed
Your contribution is much appreciated with a final score of 2! @SamuelSarle, welcome to the Hall of Sloth fame! You have been honored with a Bronze rank and a 5% lifetime bonus to all rating points you earn with your next contributions! What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
There was a problem hiding this comment.
Pull Request Overview
Adds support for the git:// URL scheme by mapping GitHub and GitLab git URLs to their raw content endpoints and fetching them via reqwest.
- Implements
open()forgit://URLs inlib/gofer/src/schemes/git.rs, including URL mapping and HTTP GET. - Introduces a new
InvalidGitUrlerror variant and conversion inlib/gofer/src/error.rs. - Updates Cargo features (enables
gitby default) and provides a usage example inlib/gofer/examples/git.rs.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/gofer/src/schemes/git.rs | Implement open() and map_git_url_to_raw_url, add tests |
| lib/gofer/src/error.rs | Add InvalidGitUrl error variant and From<Error> case |
| lib/gofer/examples/git.rs | New example demonstrating git:// usage |
| lib/gofer/Cargo.toml | Enable git in feature sets and adjust dependencies |
Comments suppressed due to low confidence (3)
lib/gofer/src/schemes/git.rs:19
- [nitpick] The variable
clientrefers to aClientBuilder, not the finalClient. Consider renaming it tobuilderto clarify its role before calling.build().
let client = ClientBuilder::new()
lib/gofer/src/schemes/git.rs:79
- Add negative tests for
map_git_url_to_raw_url, e.g. invalid prefixes, too few components, or unsupported hosts, to verify proper error handling.
mod test {
lib/gofer/examples/git.rs:1
- Include a comment or README note that the
gitfeature must be enabled when running this example (e.g.cargo run --example git --features git).
// This is free and unencumbered software released into the public domain.
|
🥁 Score it! @artob, please score the PR with |
Supports fetching a single file given
git://<host>/<owner>/<repo>/<branch_or_commit>/<path>.Closes #3