git_commit during a merge records one parent and leaves MERGE_HEAD in place
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
Línea de trabajo
El error se encuentra en src/git/src/mcp_server_git/server.py, donde git_commit llama a repo.index.commit() sin manejar el estado de fusión. Empieza por examinar esa función y la firma de IndexFile.commit() de GitPython. Cuando exista MERGE_HEAD, lee sus commits y pásalos como parent_commits, luego borra MERGE_HEAD, MERGE_MSG y MERGE_MODE. Añade una prueba en la suite de pruebas de git que realice una fusión con --no-commit, llame a git_commit y compruebe que hay dos padres y no queda estado de fusión.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 91k
- Forks
- 11.8k
- Merge medio
- 6 h 47 min
- PR fusionados (30 d)
- 74
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/servers
-
git: git_create_branch is marked non-destructive but silently resets an existing packed branchAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
modelcontextprotocol/servers#5059 ·
Los mantenedores suelen responder en 1 día
-
mcp-server-fetch: `fetch` prompt returns JSON-RPC error code 0 with the raw exception text for an invalid URLPosiblemente ocupada @DawnofGenX la tomó hace 7 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
modelcontextprotocol/servers#4914 ·
Los mantenedores suelen responder en 1 día
-
CLAUDE.md: tool-naming rule (kebab-case) disagrees with filesystem and memory serversPosiblemente ocupada @liang0417 la tomó hace 8 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
modelcontextprotocol/servers#4892 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Filesystem README recommends deprecated MCP Roots protocol for restricting directory accessPosiblemente ocupada @its-amann la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
modelcontextprotocol/servers#4844 ·
Los mantenedores suelen responder en 1 día
-
Docs: `fetch` installs npm packages during a tool call, which is worth stating for deploymentsPosiblemente ocupada @teddiesloco la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/servers#4830 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/servers
Issues similares
-
embed: handleTurboSignMessage header comment says the signing page posts to '*' (it never does)Abiertodocumentation
Dificultad 2/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Medio día Aptitud para principiantes 70/100
udistrital/paginaweb_root#23 ·
-
Aborting a request that waits for a socket destroys that socket under a later request (socket hang up)Posiblemente ocupada @vvo la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ClickHouse/clickhouse-js#1040 ·
Los mantenedores suelen responder en 7 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Small-tailqwq/dsh-deep-whale#187 ·
Los mantenedores suelen responder en 1 día
-
Tela Marca manda conferir o campo "Razão social", que em Portugal se chama "Denominação social"Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
melgarafael/DeskcommCRM#2503 ·
Los mantenedores suelen responder en 1 día