Skip to content

Unify git_log output format between filtered and unfiltered paths - #4681

Closed
sachinsharma3191 wants to merge 2 commits into
modelcontextprotocol:mainfrom
sachinsharma3191:fix/4469-git-log-schema
Closed

sachinsharma3191 wants to merge 2 commits into
modelcontextprotocol:mainfrom
sachinsharma3191:fix/4469-git-log-schema

Conversation

@sachinsharma3191

Copy link
Copy Markdown

Summary

Fixes #4469

  • Unified both code paths (date-filtered and unfiltered) into a single repo.iter_commits() call with after/before kwargs
  • Removed inconsistent !r repr formatting — output now uses clean hex SHA, Name <email> author format, and stripped commit messages in both cases
  • Removed the raw repo.git.log() path that produced different output format
  • Added test_git_log_consistent_format test verifying both paths produce identical output structure

Test plan

  • Unfiltered and date-filtered git_log calls produce identical output format
  • No repr quotes around SHA or author fields
  • Author format is Name <email> consistently
  • All 45 tests pass

Sachin and others added 2 commits August 21, 2026 16:03
…ered calls

The filtered branch (with start/end timestamps) used raw git log --format
with %s (subject only), while the unfiltered branch used Python repr (!r)
formatting on commit fields. This produced inconsistent output schemas:
- Filtered: raw hash, author name only, subject only
- Unfiltered: quoted hash, git.Actor repr, quoted message with escaped newlines

Now both paths use repo.iter_commits() with after/before kwargs, producing
a unified clean format: raw hash, "Name <email>" author, full message body.

Fixes modelcontextprotocol#4469
…hema

# Conflicts:
#	src/git/src/mcp_server_git/server.py
@sachinsharma3191

Copy link
Copy Markdown
Author

Hi maintainers, I've merged the latest main into this branch and resolved the conflict in src/git/src/mcp_server_git/server.py. main already unified the filtered and unfiltered git_log paths (since/until), so this PR now keeps that and just makes the output format consistent: plain Author: name <email> and a stripped message instead of repr() output. It also adds a regression test. All 48 git server tests pass locally and CI is green. Could someone please review and merge this when you have a moment? Thanks!

@cliffhall cliffhall added the closed-superseded-v2 Closed: fixed or made obsolete by the v2 / 2026-07-28 refactor (#4875) label Oct 20, 2026
@cliffhall

Copy link
Copy Markdown
Member

Thank you for this pull request, and apologies for the long wait for a response.

Since it was opened, the reference servers have been rebuilt for the 2026-07-28 MCP specification (#4857) and released as v2 (2.0.0 on npm for the TypeScript servers, 2026.10.19 on PyPI for the Python servers). The code this PR changes has been replaced, and the behavior it addresses has either been fixed in v2 or no longer exists in the same form.

This is not a judgment on the change or on you; it's a consequence of the code it targets having been replaced. If the problem still happens on v2, please open a fresh issue with the version you're running and steps to reproduce. Note that this repository now accepts contributions as issues rather than pull requests from anyone but its maintainers; see CONTRIBUTING.md.

This is part of the backlog triage in #4875.

@cliffhall cliffhall closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-superseded-v2 Closed: fixed or made obsolete by the v2 / 2026-07-28 refactor (#4875)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git: git_log output schema differs between filtered vs unfiltered branches

2 participants