(url: str)
| 70 | |
| 71 | |
| 72 | def safe_repo_name(url: str) -> str: |
| 73 | if os.path.exists(url): |
| 74 | return Path(url).resolve().name |
| 75 | clean = url.rstrip("/").removesuffix(".git") |
| 76 | parts = clean.split("/")[-2:] |
| 77 | return "__".join(parts) if len(parts) == 2 else hashlib.sha1(url.encode()).hexdigest()[:12] |
| 78 | |
| 79 | |
| 80 | def ensure_repo(spec: RepoSpec, cache_dir: Path) -> Path: |
no test coverage detected