Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

git: git_show diff headers lack git's a/ and b/ path prefixes

未关闭 适合新手
#5,107 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
git
领域
devtools

调研方向

问题出在 git MCP 服务器的 git_show 工具中,它输出的 diff 头部缺少 git 的 a/ 和 b/ 前缀。从 git_show 构建每个文件的 --- 和 +++ 头部行的位置开始,并与修改文件以及新增或删除文件的 git show 输出进行比较。完成的标准是头部与 git show 一致(a/<path>、b/<path>,缺失一侧使用 /dev/null),并且输出可以通过 git apply 应用。

由索引模型根据 Issue 内容生成。

描述

bug server-git v2

Problem

git_show prints each file's diff with bare paths: --- x.py^0 / +++ /dev/null, --- logic/a.py / +++ logic/a.py. git itself writes --- a/<path> / +++ b/<path>. The issue that rewrote git_show's output (#4998) asked for git's header format and /dev/null, which are met; the prefixes were left out.

Without them the output is not a patch that git apply (or patch -p1) accepts as is: they strip one leading path component, so logic/a.py is read as a.py.

Found while verifying the v1.0.0 release ledger (#5080), on mcp-server-git 2026.10.10; present on v2/main too.

Expected

git_show diff headers match git show: --- a/<path> and +++ b/<path>, with /dev/null (no prefix) for an added or deleted side.

主要语言
JavaScript
星标
91.2k
派生
11.8k
平均合并
6 小时 52 分钟
30 天内合并 PR
107

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/servers 的其他 Issue

查看 modelcontextprotocol/servers 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。