fix(git): git_log date-filtered path misparses every commit after the first#4491
Open
tao-hpu wants to merge 1 commit into
Open
fix(git): git_log date-filtered path misparses every commit after the first#4491tao-hpu wants to merge 1 commit into
tao-hpu wants to merge 1 commit into
Conversation
… first The --format string ended with a trailing %n. Together with the newline git prints between log entries, each commit emitted 5 lines while the parser walks the output in strides of 4, so field alignment broke from the second commit on (hash column blank, author column holding the hash, and so on). Drop the trailing %n so each commit is exactly 4 lines, and add a regression test covering the date-filtered path, which previously had no coverage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
git_logwithstart_timestamp/end_timestampuses--format=%H%n%an%n%ad%n%s%n. The trailing%n, plus the newline git prints between log entries, makes each commit emit 5 lines, while the parser walks the output in strides of 4 (server.py,for i in range(0, len(log_output), 4)). Alignment breaks from the second commit on.Actual output on a 3-commit repo with
start_timestamp="2000-01-01":Fix
Drop the trailing
%nso each commit is exactly 4 lines. One-character change; the non-filtered path is untouched.Tests
The date-filtered path had no coverage (
test_git_log/test_git_log_defaultonly exercise the plain path). Addedtest_git_log_with_date_filter, which asserts per-field alignment for every returned entry. Verified it fails on the old format string and passes with the fix. Full suite: 44 passed.🤖 Generated with Claude Code