(spec: RepoSpec, cache_dir: Path)
| 78 | |
| 79 | |
| 80 | def ensure_repo(spec: RepoSpec, cache_dir: Path) -> Path: |
| 81 | if os.path.isdir(spec.url) and not spec.url.startswith(("http://", "https://", "git@")): |
| 82 | return Path(spec.url).resolve() |
| 83 | cache_dir.mkdir(parents=True, exist_ok=True) |
| 84 | dest = cache_dir / safe_repo_name(spec.url) |
| 85 | if (dest / ".git").exists(): |
| 86 | run_git(["pull", "--ff-only"], dest) |
| 87 | else: |
| 88 | run_git(["clone", "--depth=1", "--filter=blob:none", spec.url, str(dest)], cache_dir) |
| 89 | return dest |
| 90 | |
| 91 | |
| 92 | def iter_code_files(root: Path, max_bytes: int, languages: Optional[set[str]]) -> Iterator[Tuple[Path, str]]: |
no test coverage detected