diff --git a/mempalace/project_scanner.py b/mempalace/project_scanner.py index e67220b..f426e8f 100644 --- a/mempalace/project_scanner.py +++ b/mempalace/project_scanner.py @@ -296,10 +296,7 @@ def _looks_like_real_name(name: str) -> bool: def _walk(root: Path, max_depth: int = MAX_DEPTH): for dirpath, dirs, files in os.walk(root): dirs[:] = [d for d in dirs if d not in SKIP_DIRS and not d.startswith(".")] - try: - rel = Path(dirpath).relative_to(root) - except ValueError: - continue + rel = Path(dirpath).relative_to(root) depth = 0 if rel == Path(".") else len(rel.parts) if depth > max_depth: dirs.clear() diff --git a/tests/test_project_scanner.py b/tests/test_project_scanner.py index 0483959..821f527 100644 --- a/tests/test_project_scanner.py +++ b/tests/test_project_scanner.py @@ -221,17 +221,25 @@ def _require_git() -> None: pytest.skip("git executable not available") -def _git_commit( - path: Path, filename: str, content: str, message: str, name: str, email: str -) -> None: - _require_git() +def _git_test_env(name: str, email: str) -> dict[str, str]: env = { - **os.environ, "GIT_AUTHOR_NAME": name, "GIT_AUTHOR_EMAIL": email, "GIT_COMMITTER_NAME": name, "GIT_COMMITTER_EMAIL": email, } + for key in ("PATH", "HOME", "SystemRoot", "ComSpec", "TMPDIR", "TEMP", "TMP"): + value = os.environ.get(key) + if value: + env[key] = value + return env + + +def _git_commit( + path: Path, filename: str, content: str, message: str, name: str, email: str +) -> None: + _require_git() + env = _git_test_env(name, email) (path / filename).write_text(content) subprocess.run(["git", "add", filename], cwd=path, check=True, env=env) subprocess.run(["git", "commit", "-q", "-m", message], cwd=path, check=True, env=env)