Skip to content

fix(git): preserve patch output from log commands - #2951

Merged
KuSh merged 2 commits into
rtk-ai:developfrom
kingpy-bot:fix/git-log-patch-passthrough-2944
Aug 14, 2026
Merged

KuSh merged 2 commits into
rtk-ai:developfrom
kingpy-bot:fix/git-log-patch-passthrough-2944

Conversation

@kingpy-bot

Copy link
Copy Markdown
Contributor

Summary

  • treat -p, -u, --patch, --patch-with-raw, and --patch-with-stat as explicit requests for raw git log output
  • stream the exact Git output instead of injecting RTK formatting, count, or merge defaults and then filtering away patch bodies
  • keep the existing compact path unchanged for non-patch log invocations

Closes #2944.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all (2,496 passed; 8 ignored)
  • end-to-end regression asserts rtk git log -p --all byte-matches raw Git and preserves a searched test-key marker

AI-assisted contribution.

@CLAassistant

CLAassistant commented Jul 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@kamusmg

kamusmg commented Jul 27, 2026

Copy link
Copy Markdown

Built this branch and ran the #2944 repro against it — it does what it claims. With a 300-line diff and the secret at ~line 152 of the hunk:

command real git this branch
git log -p 1 hit 1 hit ✅
git log --all -p 1 hit 1 hit ✅
git show HEAD 1 hit 0 out of scope here
git diff HEAD~1 1 hit 0 out of scope here
git stash show -p 1 hit 0 out of scope here

So this closes the log half cleanly. The remaining paths still route through compact_diff, so #2944 stays open after this merges — details and fixture in my comment there.

One note on the test in this PR, meant to help rather than block: compact_diff caps at 100 lines per hunk, so a fixture whose payload sits near the top of the hunk passes even with the bug present. I hit that myself — my first run "cleared" git show and git stash show for exactly that reason. Placing the payload past line 100 of the hunk makes the test fail for the right reason if the passthrough ever regresses.

(Verified on Windows / x86_64-pc-windows-gnu, develop @ 5d32d07 + 0baf07e.)

requests_raw_log_output() scanned the full args slice for patch flags
like -p, so `git log -- -p` (a literal pathspec named -p) was
misdetected as a raw patch request and skipped RTK's normal filtering.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for your contribution

@KuSh
KuSh merged commit d977e1c into rtk-ai:develop Aug 14, 2026
10 of 11 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Aug 14, 2026
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
rtk 0.46.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## [0.46.0](rtk-ai/rtk@v0.45.0...v0.46.0) (2026-08-26)


### Features

- find: dispatch on find's grammar; compress find output for unmodeled predicates ([#3603](rtk-ai/rtk#3603))
- find: tee tail hint when rtk imposes the result cap ([#3603](rtk-ai/rtk#3603))

### Bug Fixes

- find: never-worse guard, recovery hint, and dispatch on find's grammar ([#3603](rtk-ai/rtk#3603))
- git: don't misdetect a value-taking option's argument as a patch flag ([#3575](rtk-ai/rtk#3575))
- cicd: stop benchmark.sh deleting the tracked scripts/benchmark harness ([#3595](rtk-ai/rtk#3595))
- tee: hash long recovery-file slugs to prevent collisions and shorten hints ([#3266](rtk-ai/rtk#3266))
- benchmark: avoid negative curl/cargo cases that fail the benchmark job ([#3430](rtk-ai/rtk#3430))
- test: accept both Ask and Allow verdicts in rewrite tests ([#3147](rtk-ai/rtk#3147)) — Closes [#3146](rtk-ai/rtk#3146)
- core: decode process output using Windows console code page ([#2717](rtk-ai/rtk#2717)) — Closes [#2452](rtk-ai/rtk#2452)
- git: preserve patch output from log commands ([#2951](rtk-ai/rtk#2951)) — Closes [#2944](rtk-ai/rtk#2944)
- discover: sanitize drive-letter colon so Windows discover finds sessions ([#2952](rtk-ai/rtk#2952)) — Closes [#2919](rtk-ai/rtk#2919)
- stream: decode lossily instead of dropping lines on invalid UTF-8 ([#2997](rtk-ai/rtk#2997)) — Closes [#2994](rtk-ai/rtk#2994)

### Other

- test(find): use the platform temp dir instead of /tmp ([#3717](https://github.com/rtk-ai/rtk/pull/3717))</pre>
  <p>View the full release notes at <a href="https://github.com/rtk-ai/rtk/releases/tag/v0.46.0">https://github.com/rtk-ai/rtk/releases/tag/v0.46.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!17826
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.

Hook-rewritten git log -p | rg … silently drops patch bodies → false-clean secret scans

4 participants