Repository navigation
fix(mcp): support symbolic links with mode 120000 and target path content - #1837
Open
ManoharPaturi wants to merge 1 commit into
Open
ManoharPaturi wants to merge 1 commit into
ManoharPaturi wants to merge 1 commit into
Conversation
…tent Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1768
Summary
Previously,
getFileModeusedstat()rather thanlstat(). Becausestat()follows symbolic links,fileStat.isSymbolicLink()was unreachable dead code, andcommit_fileswould silently dereference symbolic links into regular file blobs. Furthermore, ifgetFileModehad usedlstat()in isolation, Git tree entries would receive mode120000whilereadFile()would still supply the dereferenced file content instead of the link target path, corrupting the tree.Changes
getFileModetosrc/mcp/file-mode.tsand implemented proper symlink detection vialstat()returning120000.commit_files(src/mcp/github-file-ops-server.ts), when a file has mode120000, read the target path withreadlink()and set the tree entry'scontentdirectly to the symlink target path rather than reading the dereferenced file bytes.test/file-mode.test.tsverifying mode resolution for regular files (100644), executables (100755), directories (040000), symbolic links (120000), and missing files fallback.Verification
bun test test/file-mode.test.tspassed (5/5).bun testpassed (971 pass, 0 fail).bun run typecheckpassed cleanly.bun run format:checkpassed.