Skip to content

fix(git): preserve --format output verbatim (no-merges bypass + no line truncation)#1187

Open
ousamabenyounes wants to merge 1 commit into
rtk-ai:developfrom
ousamabenyounes:fix/git-log-format-1058-clean
Open

fix(git): preserve --format output verbatim (no-merges bypass + no line truncation)#1187
ousamabenyounes wants to merge 1 commit into
rtk-ai:developfrom
ousamabenyounes:fix/git-log-format-1058-clean

Conversation

@ousamabenyounes
Copy link
Copy Markdown
Contributor

@ousamabenyounes ousamabenyounes commented Apr 10, 2026

Summary

Fixes #1058git log --format placeholders mangled by rtk proxy.

Two bugs in run_log corrupted output when users specified custom format flags:

  • --no-merges injected for custom formats: RTK added --no-merges even when the user passed --format, --pretty, or --oneline. For scripting use cases (date extraction, SHA lookups, changelog generation), this causes a different commit to appear when HEAD is a merge commit — the format output looks wrong even though the format string is passed through correctly.

  • Per-line truncation at 80 chars: filter_log_output truncated each line at 80 characters when user_format=true. This corrupts programmatic output — 40-char full SHAs, ISO date strings, and any custom field longer than 80 chars are silently cut.

Changes

  • run_log: skip --no-merges injection when has_format_flag=true
  • filter_log_output: when user_format=true, copy lines verbatim instead of calling truncate_line. RTK's only contribution in this path is the commit-count cap (-50 default or user's -N).
  • Two new regression tests:
    • test_filter_log_output_user_format_no_line_truncation — 40-char SHAs must not be cut
    • test_filter_log_output_user_format_multiline — multi-line formats (%H%n%s) must not lose commits

Test plan

  • cargo test test_filter_log_output_user_format — 4/4 pass
  • cargo test --all — 1373 pass, 0 regressions

🤖 Generated with Ora Studio


Vibe Coded by Ousama Ben Younes
Developed With Ora Studio (Claude Code)

@ousamabenyounes ousamabenyounes changed the base branch from master to develop April 10, 2026 15:05
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 11, 2026

CLA assistant check
All committers have signed the CLA.

…t/--pretty

Two bugs affected `git log` with custom format flags:

1. RTK added `--no-merges` even for custom `--format`/`--pretty`/`--oneline`
   requests. Scripting users rely on exact commit selection (e.g. reading
   the date of a merge commit at HEAD); silently skipping merges causes the
   wrong commit to appear.

2. `filter_log_output` truncated individual lines at 80 chars when
   `user_format=true`. This corrupts programmatic output — full 40-char SHAs,
   ISO date strings, and any line longer than 80 chars were silently cut.

Fix: when `has_format_flag=true`, skip `--no-merges` injection and copy
output lines verbatim (no per-line truncation). RTK still applies the
commit-count cap (-50 default or user's -N) so output stays bounded.

Closes rtk-ai#1058

Co-Authored-By: Claude <noreply@anthropic.com>
@ousamabenyounes ousamabenyounes force-pushed the fix/git-log-format-1058-clean branch from b46c8ad to 9e644a6 Compare April 18, 2026 09:09
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 log --format placeholders mangled by rtk proxy

3 participants