Skip to content

Commit

Permalink
Reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jan 21, 2025
1 parent 4a34f0b commit 167810b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
1 change: 0 additions & 1 deletion crates/uv-distribution/src/metadata/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ fn git_source(
) -> Result<RequirementSource, LoweringError> {
let reference = match (rev, tag, branch) {
(None, None, None) => GitReference::DefaultBranch,
// TODO(charlie): Here, we should not assume that the revision is a commit.
(Some(rev), None, None) => GitReference::from_rev(rev),
(None, Some(tag), None) => GitReference::Tag(tag),
(None, None, Some(branch)) => GitReference::Branch(branch),
Expand Down
4 changes: 1 addition & 3 deletions crates/uv-git/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ impl GitRemote {
locked_rev: Option<GitOid>,
client: &ClientWithMiddleware,
) -> Result<(GitDatabase, GitOid)> {
// So, if we have FullCommit, then we should be assuming it's actually a commit. We don't
// need to hit GitHub.
let locked_ref = locked_rev.map(|oid| GitReference::FullCommit(oid.to_string()));
let reference = locked_ref.as_ref().unwrap_or(reference);
let enable_lfs_fetch = env::var(EnvVars::UV_GIT_LFS).is_ok();
Expand Down Expand Up @@ -765,7 +763,7 @@ fn github_fast_path(
// If we know the reference is a full commit hash, we can just return it without
// querying GitHub.
return Ok(FastPathRev::NeedsFetch(rev));
},
}
};

// TODO(charlie): If we _know_ that we have a full commit SHA, there's no need to perform this
Expand Down
4 changes: 0 additions & 4 deletions crates/uv/src/commands/project/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,6 @@ fn augment_requirement(
url,
} => {
let reference = if let Some(rev) = rev {
// TODO(charlie): Here, it's probably okay for us to assume that the
// rev is a commit.
GitReference::from_rev(rev.to_string())
} else if let Some(tag) = tag {
GitReference::Tag(tag.to_string())
Expand All @@ -926,8 +924,6 @@ fn augment_requirement(
url: match requirement.url.parsed_url {
ParsedUrl::Git(mut git) => {
let reference = if let Some(rev) = rev {
// TODO(charlie): Here, it's probably okay for us to assume that the
// rev is a commit.
Some(GitReference::from_rev(rev.to_string()))
} else if let Some(tag) = tag {
Some(GitReference::Tag(tag.to_string()))
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/it/branching_urls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ fn branching_urls_of_different_sources_disjoint() -> Result<()> {
[package.metadata]
requires-dist = [
{ name = "iniconfig", marker = "python_full_version < '3.12'", url = "https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl" },
{ name = "iniconfig", marker = "python_full_version >= '3.12'", git = "https://github.com/pytest-dev/iniconfig?rev=93f5930e668c0d1ddf4597e38dd0dea4e2665e7a#93f5930e668c0d1ddf4597e38dd0dea4e2665e7a" },
{ name = "iniconfig", marker = "python_full_version >= '3.12'", git = "https://github.com/pytest-dev/iniconfig?rev=93f5930e668c0d1ddf4597e38dd0dea4e2665e7a" },
]
[[package]]
Expand Down
6 changes: 3 additions & 3 deletions crates/uv/tests/it/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ fn lock_sdist_git_subdirectory() -> Result<()> {
]

[package.metadata]
requires-dist = [{ name = "example-pkg-a", git = "https://github.com/pypa/sample-namespace-packages.git?subdirectory=pkg_resources%2Fpkg_a&rev=df7530eeb8fa0cb7dbb8ecb28363e8e36bfa2f45#df7530eeb8fa0cb7dbb8ecb28363e8e36bfa2f45" }]
requires-dist = [{ name = "example-pkg-a", git = "https://github.com/pypa/sample-namespace-packages.git?subdirectory=pkg_resources%2Fpkg_a&rev=df7530eeb8fa0cb7dbb8ecb28363e8e36bfa2f45" }]
"###
);
});
Expand Down Expand Up @@ -742,7 +742,7 @@ fn lock_sdist_git_pep508() -> Result<()> {
]

[package.metadata]
requires-dist = [{ name = "uv-public-pypackage", git = "https://github.com/astral-test/uv-public-pypackage.git?rev=0dacfd662c64cb4ceb16e6cf65a157a8b715b979#0dacfd662c64cb4ceb16e6cf65a157a8b715b979" }]
requires-dist = [{ name = "uv-public-pypackage", git = "https://github.com/astral-test/uv-public-pypackage.git?rev=0dacfd662c64cb4ceb16e6cf65a157a8b715b979" }]

[[package]]
name = "uv-public-pypackage"
Expand Down Expand Up @@ -799,7 +799,7 @@ fn lock_sdist_git_pep508() -> Result<()> {
]

[package.metadata]
requires-dist = [{ name = "uv-public-pypackage", git = "https://github.com/astral-test/uv-public-pypackage.git?rev=b270df1a2fb5d012294e9aaf05e7e0bab1e6a389#b270df1a2fb5d012294e9aaf05e7e0bab1e6a389" }]
requires-dist = [{ name = "uv-public-pypackage", git = "https://github.com/astral-test/uv-public-pypackage.git?rev=b270df1a2fb5d012294e9aaf05e7e0bab1e6a389" }]

[[package]]
name = "uv-public-pypackage"
Expand Down
12 changes: 8 additions & 4 deletions crates/uv/tests/it/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1745,11 +1745,15 @@ fn install_git_public_https_missing_commit() {
----- stderr -----
× Failed to download and build `uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage@79a935a7a1a0ad6d0bdf72dce0e16cb0a24a1b3b`
├─▶ Git operation failed
├─▶ failed to clone into: [CACHE_DIR]/git-v0/db/8dab139913c4b566
├─▶ failed to fetch commit `79a935a7a1a0ad6d0bdf72dce0e16cb0a24a1b3b`
╰─▶ process didn't exit successfully: `git fetch [...]` (exit code: 128)
├─▶ failed to find branch, tag, or commit `79a935a7a1a0ad6d0bdf72dce0e16cb0a24a1b3b`
╰─▶ process didn't exit successfully: `/usr/bin/git rev-parse '79a935a7a1a0ad6d0bdf72dce0e16cb0a24a1b3b^0'` (exit code: 128)
--- stdout
79a935a7a1a0ad6d0bdf72dce0e16cb0a24a1b3b^0
--- stderr
fatal: remote error: upload-pack: not our ref 79a935a7a1a0ad6d0bdf72dce0e16cb0a24a1b3b
fatal: ambiguous argument '79a935a7a1a0ad6d0bdf72dce0e16cb0a24a1b3b^0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
"###);
}

Expand Down

0 comments on commit 167810b

Please sign in to comment.