test(project-scanner): make gitdir fixtures portable

Agent-Logs-Url: https://github.com/MemPalace/mempalace/sessions/3c277c46-20b3-4a43-8eb7-8ee2eb3cb55a

Co-authored-by: igorls <4753812+igorls@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-24 03:53:43 +00:00
committed by GitHub
parent d4cc367261
commit 9486d8b129
2 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ MANIFEST_PRIORITY = {
"go.mod": 3, "go.mod": 3,
} }
# Sentinel so unknown manifests always sort after the known manifest types above. # Sentinel so unknown manifests always sort after the known manifest types above.
UNKNOWN_MANIFEST_PRIORITY = 999 UNKNOWN_MANIFEST_PRIORITY = max(MANIFEST_PRIORITY.values()) + 1
MANIFEST_PARSERS = { MANIFEST_PARSERS = {
"package.json": _parse_package_json, "package.json": _parse_package_json,
"pyproject.toml": _parse_pyproject, "pyproject.toml": _parse_pyproject,
+8 -4
View File
@@ -32,6 +32,10 @@ GIT_ENV_ALLOWLIST = ("HOME", "SystemRoot", "ComSpec", "TMPDIR", "TEMP", "TMP")
GIT_EXECUTABLE = shutil.which("git") GIT_EXECUTABLE = shutil.which("git")
def _gitdir_marker(path: Path) -> str:
return f"gitdir: {path}\n"
# ── manifest parsers ──────────────────────────────────────────────────── # ── manifest parsers ────────────────────────────────────────────────────
@@ -204,10 +208,10 @@ def test_find_git_repos_skips_nested_inside_repo(tmp_path):
def test_find_git_repos_detects_git_file_markers(tmp_path): def test_find_git_repos_detects_git_file_markers(tmp_path):
(tmp_path / ".git").write_text("gitdir: /tmp/root.git\n") (tmp_path / ".git").write_text(_gitdir_marker(tmp_path.parent / "root.git"))
sub = tmp_path / "subproject" sub = tmp_path / "subproject"
sub.mkdir() sub.mkdir()
(sub / ".git").write_text("gitdir: /tmp/sub.git\n") (sub / ".git").write_text(_gitdir_marker(tmp_path.parent / "sub.git"))
repos = find_git_repos(tmp_path) repos = find_git_repos(tmp_path)
assert tmp_path in repos assert tmp_path in repos
assert sub in repos assert sub in repos
@@ -311,11 +315,11 @@ def test_scan_manifest_only_no_git(tmp_path):
def test_collect_manifest_names_stops_at_git_file_boundary(tmp_path): def test_collect_manifest_names_stops_at_git_file_boundary(tmp_path):
(tmp_path / ".git").write_text("gitdir: /tmp/root.git\n") (tmp_path / ".git").write_text(_gitdir_marker(tmp_path.parent / "root.git"))
(tmp_path / "package.json").write_text(json.dumps({"name": "root-name"})) (tmp_path / "package.json").write_text(json.dumps({"name": "root-name"}))
nested = tmp_path / "nested" nested = tmp_path / "nested"
nested.mkdir() nested.mkdir()
(nested / ".git").write_text("gitdir: /tmp/nested.git\n") (nested / ".git").write_text(_gitdir_marker(tmp_path.parent / "nested.git"))
(nested / "package.json").write_text(json.dumps({"name": "nested-name"})) (nested / "package.json").write_text(json.dumps({"name": "nested-name"}))
manifests = _collect_manifest_names(tmp_path) manifests = _collect_manifest_names(tmp_path)
assert [name for _file, name, _dir in manifests] == ["root-name"] assert [name for _file, name, _dir in manifests] == ["root-name"]