Skip to content

fix(git): keep machine output raw#2573

Open
YOMXXX wants to merge 1 commit into
rtk-ai:developfrom
YOMXXX:fix/issue-2487-git-machine-output
Open

fix(git): keep machine output raw#2573
YOMXXX wants to merge 1 commit into
rtk-ai:developfrom
YOMXXX:fix/issue-2487-git-machine-output

Conversation

@YOMXXX

@YOMXXX YOMXXX commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #2487.

Summary

  • Keep git commands raw in hook rewrite when stdout is piped, redirected to a file, or explicitly machine-readable (--porcelain, --format, --name-only, -z, etc.).
  • Preserve normal model-facing rewrites such as bare git diff and later segments in compound commands.
  • Make direct rtk git status --porcelain, rtk git log --format=..., and rtk git diff --name-only pass through byte-for-byte instead of compacting.

Verification

  • cargo +1.93.0 test rewrite_git_ -- --nocapture
  • cargo +1.93.0 test rewrite_redirect -- --nocapture
  • cargo +1.93.0 test registry -- --nocapture
  • cargo +1.93.0 test git::git::tests::test_ -- --nocapture
  • CLI smoke: rewrite passthrough for git status --porcelain | wc -l, git log --format=%H | sort, git diff --name-only HEAD~1..HEAD; rewrite still active for bare git diff
  • CLI smoke: rtk git diff --name-only, rtk git status --porcelain, and rtk git log --format=%H -3 match native git via cmp
  • cargo +1.93.0 fmt --all -- --check
  • cargo +1.93.0 clippy --all-targets
  • cargo +1.93.0 test --all -- --skip small_grep_not_worse_than_plain
  • git diff --check

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.

rtk compacts machine-bound git output (--porcelain / --name-only / piped), silently corrupting consumers

1 participant