git_commit during a merge records one parent and leaves MERGE_HEAD in place
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
バグは src/git/src/mcp_server_git/server.py に存在し、git_commit がマージ状態を処理せずに repo.index.commit() を呼び出していることが原因です。まず当該関数とGitPythonの IndexFile.commit() のシグネチャを確認してください。MERGE_HEAD が存在する場合は、そのコミットを読み取って parent_commits として渡し、その後 MERGE_HEAD、MERGE_MSG、MERGE_MODE をクリアしてください。gitテストスイートに、--no-commit オプションでマージを実行し git_commit を呼び出して、2つの親が存在しマージ状態が残存しないことをアサートするテストを追加してください。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
git_commit cannot conclude a merge. While a merge is in progress (MERGE_HEAD present, e.g. after git merge --no-commit or a resolved conflict), it writes a commit with one parent, HEAD, and leaves MERGE_HEAD (and MERGE_MSG) in place, so the repository stays in merge state and the merged branch's history is not recorded.
src/git/src/mcp_server_git/server.py, git_commit calls repo.index.commit(message). GitPython's IndexFile.commit() takes parent_commits=None, which means [repo.head.commit] only; it neither reads nor clears MERGE_HEAD.
Found in the Copilot review of #5007 (the fix for #4762), which keeps the empty-merge-commit case committable but, like the code before it, records it with one parent. This predates #5007: any merge resolved through git_commit has always been recorded this way.
To Reproduce
import git
# repo on main with a branch `side` that adds side.txt
repo.git.merge("side", "--no-commit", "--no-ff")
commit = repo.index.commit("merge side") # what git_commit does
len(commit.parents) # 1, git commit would give 2
(Path(repo.git_dir) / "MERGE_HEAD").exists() # True, merge still in progress
Expected behavior
While MERGE_HEAD is present, git_commit records HEAD plus every MERGE_HEAD commit as parents and clears the merge state, as git commit does (either by shelling out to git commit, or by passing parent_commits and removing MERGE_HEAD/MERGE_MSG/MERGE_MODE). A test asserts both parents and that MERGE_HEAD is gone.
Additional context
Related: #659 (a git_merge tool), which would make this path reachable from the server alone.
- 主要言語
- TypeScript
- スター
- 91k
- フォーク
- 11.8k
- 平均マージ
- 6時間 47分
- マージ済み PR(30日)
- 74
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/servers のほかの issue
-
mcp-server-fetch: `fetch` prompt returns JSON-RPC error code 0 with the raw exception text for an invalid URL対応中かも @DawnofGenX が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/servers#4914 ·
メンテナーはふだん 1 日以内に返信
-
CLAUDE.md: tool-naming rule (kebab-case) disagrees with filesystem and memory servers対応中かも @liang0417 が 7 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
modelcontextprotocol/servers#4892 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Filesystem README recommends deprecated MCP Roots protocol for restricting directory access対応中かも @its-amann が 12 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelcontextprotocol/servers#4844 ·
メンテナーはふだん 1 日以内に返信
-
Docs: `fetch` installs npm packages during a tool call, which is worth stating for deployments対応中かも @teddiesloco が 16 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/servers#4830 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Docs: tool descriptions for browser-embedding servers do not mention the browser's own background traffic対応中かも @AbhiPra24 が 13 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/servers#4829 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/servers の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
wardian-app/Wardian#1603 ·
メンテナーはふだん 1 日以内に返信
-
Sign the pledgeオープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
input-output-hk/devx-updates#168 ·
メンテナーはふだん 1 日以内に返信
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
github/docs#46222 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent-ready area: config area: skills type: chore upstream: brain-kit
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
dev experience frontend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
cuttle-cards/cuttle#1403 ·
メンテナーはふだん 1 日以内に返信