From 23f8121d82df7798747a47afc3ffd0384b53b582 Mon Sep 17 00:00:00 2001 From: Seth Grover Date: Mon, 17 Aug 2026 22:43:24 +0000 Subject: [PATCH] fix(repo): add REPO_URL=local sentinel to bypass git entirely DTLRepo always ran a clone or a fetch, even when REPO_PATH already held the library contents locally. validate_git_url() rejected the old 'local' value outright, and even a valid URL still triggered a real git fetch against the remote on every run. REPO_URL=local now skips Repo(), clone_from(), and fetch() entirely. REPO_PATH is used as-is and must already contain device-types/, module-types/, and rack-types/ (no .git required, and none is used). --- core/repo.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/core/repo.py b/core/repo.py index 869bedd6..74688641 100644 --- a/core/repo.py +++ b/core/repo.py @@ -419,11 +419,13 @@ class DTLRepo: def __init__(self, config, handle): """Initialize repository management, updating an existing clone or creating a new one. - If the target path already holds a Git clone, the repository will be updated from - its configured remote; otherwise the provided URL is validated and a new clone is - created. The initializer sets instance attributes used by other methods (handler, - supported YAML extensions, URL, repo path, branch, repo reference, and current - working directory). + If REPO_URL is the sentinel "local", no git operation of any kind is performed — + REPO_PATH is used as-is and must already contain the device-type file tree. + Otherwise, if the target path already holds a Git clone, the repository will be + updated from its configured remote; if not, the provided URL is validated and a new + clone is created. The initializer sets instance attributes used by other methods + (handler, supported YAML extensions, URL, repo path, branch, repo reference, and + current working directory). Args: config (RunConfig): Supplies `repo_url`, `repo_branch`, and `repo_path`. @@ -441,6 +443,14 @@ def __init__(self, config, handle): self.repo = None self.cwd = os.getcwd() + if str(self.url).strip().casefold() == "local": + if not os.path.isdir(self.get_absolute_path()): + raise InvalidRepoPathError( + self.repo_path, reason="REPO_URL=local requires REPO_PATH to already contain the library files" + ) + self.handle.log(f"REPO_URL=local: using {self.get_absolute_path()} as-is, no git operations") + return + is_path_valid, path_error = validate_repo_path(self.repo_path) if not is_path_valid: raise InvalidRepoPathError(self.repo_path, reason=path_error)