Use separate representations for canonical repository vs. commit (#317)

Given `https://github.com/pypa/package.git#subdirectory=pkg_a` and
`https://github.com/pypa/package.git#subdirectory=pkg_b`, we want these
to map to the same shared _resource_ (for locking and cloning), but
different _packages_ (for determining whether the wheel already exists
in the cache). As such, we need two distinct concepts for "canonical
equality".

Closes #316.
This commit is contained in:
Charlie Marsh 2023-11-04 08:46:42 -07:00 committed by GitHub
parent b589813e59
commit 051188dce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 192 additions and 25 deletions

View file

@ -7,7 +7,7 @@ use anyhow::Result;
use reqwest::Client;
use tracing::debug;
use puffin_cache::{digest, CanonicalUrl};
use puffin_cache::{digest, RepositoryUrl};
use crate::git::GitRemote;
use crate::{FetchStrategy, Git};
@ -36,7 +36,7 @@ impl GitSource {
pub fn fetch(self) -> Result<Fetch> {
// The path to the repo, within the Git database.
let ident = digest(&CanonicalUrl::new(&self.git.url));
let ident = digest(&RepositoryUrl::new(&self.git.url));
let db_path = self.cache.join("db").join(&ident);
let remote = GitRemote::new(&self.git.url);