uv
0d15758b - Separate Git and ordinary URL normalization (#23082)

Commit
5 days ago
Separate Git and ordinary URL normalization (#23082) URLs such as `/simple/` and `/simple.git/` can point to different indexes, but uv currently gives them the same cache key. If both provide a wheel with the same name and version, uv can silently install the wheel cached from the other index. This PR separates git repo identity from ordinary URL identity to address the above. `CanonicalUrl::new` now preserves `.git` in HTTP paths, and as a consequence there are three areas this PR changes: 1. git checkouts & DBs: The new `GitUpstreamUrl` type identifies the repository after the ref has been parsed. With this type `foo.git` and `foo` can share a git DB. 2. Resolver metadata: `DistributionId` compares the parsed git ref separately from the repo URL (previously it used the normalized full url). Now, `pkg@git+https://github.com/foo/repo.git@Main` and `pkg@git+https://github.com/foo/repo@main` get distinct distribution IDs while sharing the same repository ID. 3. Built wheels: these use the new `CanonicalUrl::for_git_source` which preserves the previous behavior. This is important because uv uses `CanonicalUrl` for index identity (among other things), where this git repo-specific behavior isn't desirable. > [!NOTE] > The wheel and sdist caches are bumped to `wheels-v8` and `sdists-v11` so uv skips artifacts stored under the old shared URL keys. Simple API cache hits always matched on the full URL so they don't need a bump.
Author
Parents
Loading