From c63c42cb090fb7106d4c592f52ff797a8eb2a624 Mon Sep 17 00:00:00 2001 From: Tanner Doshier Date: Thu, 30 Jan 2025 13:38:34 -0500 Subject: [PATCH] util/git: Support Copier URI aliases --- nava/platform/util/git.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nava/platform/util/git.py b/nava/platform/util/git.py index 125f3a7..8363e84 100644 --- a/nava/platform/util/git.py +++ b/nava/platform/util/git.py @@ -5,6 +5,10 @@ from tempfile import TemporaryDirectory from typing import Any, Self +# TODO: reimplment get_repo functionality here and also consider additionally +# supporting slightly clearer `github:` prefix +from copier.vcs import get_repo + class GitProject: def __init__(self, dir: Path): @@ -32,7 +36,7 @@ def clone_if_necessary(cls, repo_uri: str) -> Generator[Self, None, None]: else: with TemporaryDirectory() as dir: dir_path = Path(dir) - clone_result = clone_to(repo_uri, dir_path) + clone_result = clone_to(get_repo(repo_uri), dir_path) clone_result.check_returncode() yield cls(dir_path) @@ -166,7 +170,6 @@ def is_a_git_worktree(dir: Path) -> bool: return result.stdout.strip() == "true" -# TODO: could use copier.vcs.clone? def clone_to(url: str, dest: Path, ref: str | None = None) -> subprocess.CompletedProcess[str]: clone_result = run_text(["git", "clone", "--filter=blob:none", url, dest])