uv icon indicating copy to clipboard operation
uv copied to clipboard

Git references are not normalized in lockfile

Open ibraheemdev opened this issue 1 year ago • 2 comments

The lockfile currently differentiates between identical Git references depending on how they are declared. For example:

[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
    "uv-public-pypackage @ git+https://github.com/astral-test/[email protected]"
]
version = 1
requires-python = ">=3.12"

[[distribution]]
name = "project"
version = "0.1.0"
source = "editable+."
sdist = { path = "." }

[[distribution.dependencies]]
name = "uv-public-pypackage"
version = "0.1.0"
source = "git+https://github.com/astral-test/uv-public-pypackage?rev=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"

[[distribution]]
name = "uv-public-pypackage"
version = "0.1.0"
source = "git+https://github.com/astral-test/uv-public-pypackage?rev=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"
sdist = { url = "https://github.com/astral-test/uv-public-pypackage?rev=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979" }

Versus:

[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
    "uv-public-pypackage",
]

[tool.uv.sources]
uv-public-pypackage = { git = "https://github.com/astral-test/uv-public-pypackage", tag = "0.0.1" }
version = 1
requires-python = ">=3.12"

[[distribution]]
name = "project"
version = "0.1.0"
source = "editable+."
sdist = { path = "." }

[[distribution.dependencies]]
name = "uv-public-pypackage"
version = "0.1.0"
- source = "git+https://github.com/astral-test/uv-public-pypackage?rev=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"
+ source = "git+https://github.com/astral-test/uv-public-pypackage?tag=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"

[[distribution]]
name = "uv-public-pypackage"
version = "0.1.0"
- source = "git+https://github.com/astral-test/uv-public-pypackage?rev=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"
+ source = "git+https://github.com/astral-test/uv-public-pypackage?tag=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979"
- sdist = { url = "https://github.com/astral-test/uv-public-pypackage?rev=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979" }
+ sdist = { url = "https://github.com/astral-test/uv-public-pypackage?tag=0.0.1#0dacfd662c64cb4ceb16e6cf65a157a8b715b979" }

I'm not sure if we can normalize to the revision because the commit pointed to by a tag/branch can change, but we could disambiguate between references before locking.

ibraheemdev avatar Jun 19 '24 18:06 ibraheemdev

I think it's correct that we write different values here. Is it getting in your way somewhere?

charliermarsh avatar Jun 24 '24 12:06 charliermarsh

Not getting in the way, @konstin pointed it out in https://github.com/astral-sh/uv/pull/4406.

ibraheemdev avatar Jul 01 '24 21:07 ibraheemdev

I think this is as-intended.

charliermarsh avatar Jul 28 '24 00:07 charliermarsh