From fa5180bd513a0e201fa661d85800c4c9a7da19ab Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 31 Aug 2026 16:49:39 -0400 Subject: [PATCH] Keep local .git paths with pio run --- esphome/platformio/prefetch.py | 4 ++-- tests/unit_tests/test_platformio_prefetch.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/platformio/prefetch.py b/esphome/platformio/prefetch.py index 092f4382e2..314b063106 100644 --- a/esphome/platformio/prefetch.py +++ b/esphome/platformio/prefetch.py @@ -384,11 +384,11 @@ def _is_vcs_spec_uri(url: str | None) -> bool: copy or download it (PackageSpec normalizes git URLs to ``git+``). The .git check runs first so an un-normalized repo URL degrades to a failed clone and pio run, never an archive download of a repo page.""" - if not url: + if not url or url.startswith(("file://", "symlink://")): return False if url.split("#", 1)[0].endswith(".git"): return True - if url.startswith(("file://", "symlink://", "http://", "https://")): + if url.startswith(("http://", "https://")): return False return url.startswith(_VCS_URI_PREFIXES) diff --git a/tests/unit_tests/test_platformio_prefetch.py b/tests/unit_tests/test_platformio_prefetch.py index 737d73e9bc..d9c9a7d9af 100644 --- a/tests/unit_tests/test_platformio_prefetch.py +++ b/tests/unit_tests/test_platformio_prefetch.py @@ -632,6 +632,8 @@ def test_uri_jobs_vcs_specs_installable_without_probe(tmp_path: Path) -> None: # downloadable archive), then drops here as derived-name _FakeSpec(uri="https://x/unnorm.git", name="unnorm"), _FakeSpec(uri="file:///local/dir", name="local"), + # A local .git path is copied in place, never cloned + _FakeSpec(uri="file:///local/repo.git", name="localgit"), _FakeSpec(uri="symlink:///local/dir", name="link"), ], set(),