@@ -17389,3 +17389,144 @@ fn lock_group_empty_entry_table() -> Result<()> {
1738917389
1739017390 Ok(())
1739117391}
17392+
17393+ #[test]
17394+ fn lock_transitive_git() -> Result<()> {
17395+ let context = TestContext::new("3.12");
17396+
17397+ let pyproject_toml = context.temp_dir.child("pyproject.toml");
17398+ pyproject_toml.write_str(
17399+ r#"
17400+ [project]
17401+ name = "a"
17402+ version = "0.1.0"
17403+ requires-python = ">=3.12"
17404+ dependencies = ["c"]
17405+
17406+ [tool.uv.sources]
17407+ c = { git = "https://github.com/astral-sh/workspace-virtual-root-test", subdirectory = "packages/c", rev = "fac39c8d4c5d0ef32744e2bb309bbe34a759fd46" }
17408+ "#,
17409+ )?;
17410+
17411+ uv_snapshot!(context.filters(), context.lock(), @r###"
17412+ success: true
17413+ exit_code: 0
17414+ ----- stdout -----
17415+
17416+ ----- stderr -----
17417+ Resolved 6 packages in [TIME]
17418+ "###);
17419+
17420+ let lock = context.read("uv.lock");
17421+
17422+ insta::with_settings!({
17423+ filters => context.filters(),
17424+ }, {
17425+ assert_snapshot!(
17426+ lock, @r###"
17427+ version = 1
17428+ requires-python = ">=3.12"
17429+
17430+ [options]
17431+ exclude-newer = "2024-03-25T00:00:00Z"
17432+
17433+ [[package]]
17434+ name = "a"
17435+ version = "0.1.0"
17436+ source = { virtual = "." }
17437+ dependencies = [
17438+ { name = "c" },
17439+ ]
17440+
17441+ [package.metadata]
17442+ requires-dist = [{ name = "c", git = "https://github.com/astral-sh/workspace-virtual-root-test?subdirectory=packages%2Fc&rev=fac39c8d4c5d0ef32744e2bb309bbe34a759fd46" }]
17443+
17444+ [[package]]
17445+ name = "anyio"
17446+ version = "4.3.0"
17447+ source = { registry = "https://pypi.org/simple" }
17448+ dependencies = [
17449+ { name = "idna" },
17450+ { name = "sniffio" },
17451+ ]
17452+ sdist = { url = "https://files.pythonhosted.org/packages/db/4d/3970183622f0330d3c23d9b8a5f52e365e50381fd484d08e3285104333d3/anyio-4.3.0.tar.gz", hash = "sha256:f75253795a87df48568485fd18cdd2a3fa5c4f7c5be8e5e36637733fce06fed6", size = 159642 }
17453+ wheels = [
17454+ { url = "https://files.pythonhosted.org/packages/14/fd/2f20c40b45e4fb4324834aea24bd4afdf1143390242c0b33774da0e2e34f/anyio-4.3.0-py3-none-any.whl", hash = "sha256:048e05d0f6caeed70d731f3db756d35dcc1f35747c8c403364a8332c630441b8", size = 85584 },
17455+ ]
17456+
17457+ [[package]]
17458+ name = "c"
17459+ version = "1.0.0"
17460+ source = { git = "https://github.com/astral-sh/workspace-virtual-root-test?subdirectory=packages%2Fc&rev=fac39c8d4c5d0ef32744e2bb309bbe34a759fd46#fac39c8d4c5d0ef32744e2bb309bbe34a759fd46" }
17461+ dependencies = [
17462+ { name = "d" },
17463+ ]
17464+
17465+ [[package]]
17466+ name = "d"
17467+ version = "1.0.0"
17468+ source = { git = "https://github.com/astral-sh/workspace-virtual-root-test?subdirectory=packages%2Fd&rev=fac39c8d4c5d0ef32744e2bb309bbe34a759fd46#fac39c8d4c5d0ef32744e2bb309bbe34a759fd46" }
17469+ dependencies = [
17470+ { name = "anyio" },
17471+ ]
17472+
17473+ [[package]]
17474+ name = "idna"
17475+ version = "3.6"
17476+ source = { registry = "https://pypi.org/simple" }
17477+ sdist = { url = "https://files.pythonhosted.org/packages/bf/3f/ea4b9117521a1e9c50344b909be7886dd00a519552724809bb1f486986c2/idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca", size = 175426 }
17478+ wheels = [
17479+ { url = "https://files.pythonhosted.org/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f", size = 61567 },
17480+ ]
17481+
17482+ [[package]]
17483+ name = "sniffio"
17484+ version = "1.3.1"
17485+ source = { registry = "https://pypi.org/simple" }
17486+ sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372 }
17487+ wheels = [
17488+ { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 },
17489+ ]
17490+ "###
17491+ );
17492+ });
17493+
17494+ // Re-run with `--locked`.
17495+ uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
17496+ success: true
17497+ exit_code: 0
17498+ ----- stdout -----
17499+
17500+ ----- stderr -----
17501+ Resolved 6 packages in [TIME]
17502+ "###);
17503+
17504+ // Re-run with `--offline`. We shouldn't need a network connection to validate an
17505+ // already-correct lockfile with immutable metadata.
17506+ uv_snapshot!(context.filters(), context.lock().arg("--locked").arg("--offline").arg("--no-cache"), @r###"
17507+ success: true
17508+ exit_code: 0
17509+ ----- stdout -----
17510+
17511+ ----- stderr -----
17512+ Resolved 6 packages in [TIME]
17513+ "###);
17514+
17515+ // Install from the lockfile.
17516+ uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###"
17517+ success: true
17518+ exit_code: 0
17519+ ----- stdout -----
17520+
17521+ ----- stderr -----
17522+ Prepared 5 packages in [TIME]
17523+ Installed 5 packages in [TIME]
17524+ + anyio==4.3.0
17525+ + c==1.0.0 (from git+https://github.com/astral-sh/workspace-virtual-root-test@fac39c8d4c5d0ef32744e2bb309bbe34a759fd46#subdirectory=packages/c)
17526+ + d==1.0.0 (from git+https://github.com/astral-sh/workspace-virtual-root-test@fac39c8d4c5d0ef32744e2bb309bbe34a759fd46#subdirectory=packages/d)
17527+ + idna==3.6
17528+ + sniffio==1.3.1
17529+ "###);
17530+
17531+ Ok(())
17532+ }
0 commit comments