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

Add a GitHub repository struct to uv-git #10768

Merged
merged 2 commits into from
Jan 20, 2025
Merged

Add a GitHub repository struct to uv-git #10768

merged 2 commits into from
Jan 20, 2025

Conversation

charliermarsh
Copy link
Member

Summary

This is useful for #10765, but we already have one usage today, so carving it out into a standalone PR.

@charliermarsh charliermarsh added the internal A refactor or improvement that is not user-facing label Jan 20, 2025
let response_code = response.status();
if response_code == StatusCode::NOT_MODIFIED {
Ok(FastPathRev::UpToDate)
} else if response_code == StatusCode::OK {
let oid_to_fetch = response.text().await?.parse()?;
Ok(FastPathRev::NeedsFetch(oid_to_fetch))
} else {
// Usually response_code == 404 if the repository does not exist, and
// response_code == 422 if exists but GitHub is unable to resolve the
// requested rev.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the wrong place. 400-level errors are raised by response.error_for_status_ref()?!

/// repository, like `astral-sh`.
pub owner: &'a str,
/// The `repo` field for the repository, i.e., the name of the repository, like `uv`.
pub repo: &'a str,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uses the terminology of the GitHub API.

crates/uv-git/src/github.rs Outdated Show resolved Hide resolved
Co-authored-by: konsti <konstin@mailbox.org>
@charliermarsh charliermarsh enabled auto-merge (squash) January 20, 2025 14:29
@charliermarsh charliermarsh merged commit 9e6e1e5 into main Jan 20, 2025
63 checks passed
@charliermarsh charliermarsh deleted the charlie/github branch January 20, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants