Skip to content

fix(git): unify git_log output schema and remove raise_exceptions from server.run - #4658

Open
AbhiPra24 wants to merge 1 commit into
modelcontextprotocol:mainfrom
AbhiPra24:fix/git-log-formatting-and-graceful-exceptions
Open

fix(git): unify git_log output schema and remove raise_exceptions from server.run#4658
AbhiPra24 wants to merge 1 commit into
modelcontextprotocol:mainfrom
AbhiPra24:fix/git-log-formatting-and-graceful-exceptions

Conversation

@AbhiPra24

Copy link
Copy Markdown

Summary

Fixes #4469 and #4213.

1. Unified git_log Output Schema (Fixes #4469)

  • Problem: The unfiltered git_log branch used !r formatting (commit.hexsha!r, commit.author!r, commit.message!r), which produced string representations with Python quotes, escaped newlines, and object repr (<git.Actor "Name <email>">). Meanwhile, the filtered branch used --format=%H%n%an%n%ad%n%s%n, which stripped commit bodies and output unquoted strings.
  • Fix: Unified both branches with repo.iter_commits(), passing since/until filters when provided, preserving full multiline commit messages and consistent string outputs across both branches without !r quotes.

2. Remove raise_exceptions=True from server.run() (Fixes #4213)

  • Problem: server.run(..., raise_exceptions=True) crashed the server process on malformed JSON-RPC messages instead of returning a JSON-RPC error response (following the fix applied to fetch server in fix(fetch): handle malformed input without crashing #3515).
  • Fix: Removed raise_exceptions=True from server.run().

Verification

  • Added 4 new regression tests in src/git/tests/test_server.py.
  • pytest executed: 47 passed in 2.65s.
  • ruff check and pyright both passed with 0 errors.

cc @olaservo for review when available. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git: git_log output schema differs between filtered vs unfiltered branches [git] raise_exceptions=True

1 participant