mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-26 06:43:15 +08:00
Replace the manual join(input_path, --git-common-dir) + realpath/_fullpath with `git rev-parse --path-format=absolute --git-common-dir` (git 2.31+), which returns git's own absolute, canonical common-dir. Because a main repo and its linked worktree both query the same git binary, they resolve to the IDENTICAL path, so canonical_root is consistent across worktrees and platforms with no platform-specific path canonicalization. This is the truly platform-agnostic #659 fix: - git resolves the relative ".." internally, so a project indexed from a subdirectory gets the real repo root (the #659 bug). - No realpath/_fullpath, so the msys-vs-native path-representation divergence that broke the worktree==main-root invariant (test_pipeline.c git_context_linked_worktree) on the Windows CI leg is eliminated — both sides get git's single canonical representation. Falls back to the previous relative-join derivation (Unix realpath) when git is older than 2.31 and doesn't support --path-format (abs_common_dir empty). The input_path-join fix and the Windows test-harness SKIP_PLATFORM guards from the earlier commits on this branch remain for that fallback path. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com> Co-Authored-By: anivaryam <anivaryam.dev@gmail.com>