Files
Martin Vogel 357d71e198 fix(mcp): translate Git-root paths for subdirectory projects in detect_changes (#1951)
When the indexed project root is a subdirectory of a normal Git
repository, detect_changes found the changed file but seeded zero
symbols. Git reports diff and porcelain status paths relative to the
Git ROOT ("game/src/math.ts"), while graph file_paths are relative to
the project root ("src/math.ts"), so the seed lookup never matched.
The same mismatch left the hunk-scoping paths and the snapshot
fingerprint (root_path + git path) pointing at the wrong files.

Resolve the project's position in the worktree with
`rev-parse --show-prefix` in the existing revision-resolution call,
translate every diff/status record into project-relative coordinates
(records outside the project are left out, as they have no graph
nodes), and run the hunk diff with --relative so hunk paths use the
same coordinates. At the repository root the prefix is empty and the
behavior is unchanged.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-09-25 18:37:16 +02:00
..