Skip to content

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

Open
sachinsharma3191 wants to merge 1 commit into
modelcontextprotocol:mainfrom
sachinsharma3191:fix/4469-git-log-schema
Open

Unify git_log output format between filtered and unfiltered paths#4681
sachinsharma3191 wants to merge 1 commit 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

…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
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

1 participant