Skip to content

fix(git): normalize git_log and git_show formatting across filtered and unfiltered queries - #4644

Closed
teddiesloco wants to merge 1 commit into
modelcontextprotocol:mainfrom
teddiesloco:fix/git-log-format-and-representation
Closed

teddiesloco wants to merge 1 commit into
modelcontextprotocol:mainfrom
teddiesloco:fix/git-log-format-and-representation

Conversation

@teddiesloco

Copy link
Copy Markdown
Contributor

Summary

Fixes the schema and formatting asymmetry between filtered (start_timestamp / end_timestamp) and unfiltered calls in git_log, as well as git_show.

Root Cause

  1. Repr vs Plain String: In unfiltered git_log and git_show, commit.hexsha!r and commit.message!r were used, producing quoted strings like Commit: 'b9fd86...' and Message: 'feat: ...'. In contrast, the timestamp-filtered branch produced unquoted Commit: b9fd86....
  2. Author Format Asymmetry: Filtered queries produced Author: Name <email> or plain author name, whereas unfiltered queries produced Author: <git.Actor "Name <email>">.
  3. Date Format Asymmetry: Filtered queries used git CLI's human-readable format while unfiltered queries used Python datetime object string.
  4. Delimiter Safety: Date-filtered git log now uses ASCII Unit/Record Separators (%x1e / %x1f) instead of splitting by raw newlines (\n), preventing multi-line commit messages from corrupting the parsed log entry count.

Fix

  • Standardized both code paths to output clean unquoted Commit: <sha>, Author: Name <email>, ISO-8601 Date: <iso_datetime>, and clean Message: <message>.
  • Added Unit Separator delimiters in git log command to handle arbitrary multi-line commit subjects safely.
  • Added regression test test_git_log_schema_consistency asserting schema uniformity across filtered and unfiltered queries.

Verification

  • Ran full test suite via uv run pytest tests/ -q (43/43 PASS).
  • Verified monorepo build (npm run build clean across all workspace packages).

@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.

2 participants