fix: respect user-specified git log limits (#461)#505
Merged
pszymkowiak merged 2 commits intortk-ai:developfrom Mar 11, 2026
Merged
fix: respect user-specified git log limits (#461)#505pszymkowiak merged 2 commits intortk-ai:developfrom
pszymkowiak merged 2 commits intortk-ai:developfrom
Conversation
…ting RTK was silently capping git log output in two ways: 1. `--oneline` without `-N` defaulted to 10 entries (now 50) 2. `filter_log_output()` re-truncated even when user explicitly set `-N` 3. Lines >80 chars were truncated, hiding PR numbers and author names This matters for LLM workflows: Claude needs full commit history for rebase, squash, and changelog operations. Silent truncation caused incomplete context and repeated re-runs. Changes: - User-explicit `-N` → no line cap, wider 120-char truncation - `--oneline`/`--pretty` without `-N` → default 50 (was 10) - No flags → unchanged (default 10) - Extract `truncate_line()` helper for clarity Fixes rtk-ai#461 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3098ec7 to
07901c8
Compare
- Extract parse_user_limit() to handle all 4 forms: -20, -n 20, --max-count=20, --max-count 20 - Add token savings test for filter_log_output (≥60%) - Add 5 tests for parse_user_limit edge cases Signed-off-by: Patrick <patrick@rtk-ai.com> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Collaborator
|
Thanks @ousamabenyounes! The I rebased onto
799 tests pass. Merging into |
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.
Summary
Fixes #461 —
rtk git log --onelinesilently truncates output to 10 entries regardless of user intent.Root cause: Two layers of truncation were fighting each other:
run_log()injected-10when no-Nflag was present (even with--oneline)filter_log_output()applied.take(limit)again, re-capping even when the user explicitly passed-NWhy this matters for LLM workflows:
git log --oneline -30for rebase/squash: only got 10 commits, forcing re-runsgit log --onelinefor changelog: silently incomplete history(#473)and author names were truncated at 80 charsChanges
rtk git log --oneline(no-N)rtk git log -20rtk git log(no flags)-NBefore/After
Test plan
test_filter_log_output_user_limit_no_cap,test_filter_log_output_user_limit_wider_truncationfilter_log_outputtests pass--oneline,-20, default (no flags)cargo fmt && cargo clippy && cargo testall greenGenerated with Claude Code