Skip to content

fix(git): pass through --check/--exit-code/--quiet/--no-patch unfiltered - #3988

Closed
yunaremaia wants to merge 1 commit into
rtk-ai:developfrom
yunaremaia:fix/diff-check-passthrough
Closed

yunaremaia wants to merge 1 commit into
rtk-ai:developfrom
yunaremaia:fix/diff-check-passthrough

Conversation

@yunaremaia

@yunaremaia yunaremaia commented Sep 11, 2026 •

Copy link
Copy Markdown

Summary

Diagnostic modes --check, --exit-code, --quiet, and --no-patch derive their value entirely from stdout and exit code. RTK's git diff filter destroyed that signal — rtk git diff --check returned exit 2 with zero bytes of output, leaving agents and pre-commit scripts with "failure with no reason attached".

This PR adds an is_diagnostic gate that routes these flags through the existing passthrough path.

Changes

  • src/cmds/git/git.rs — added is_diagnostic flag detection in run_diff, ANDed into wants_compact so diagnostic modes skip compaction
  • Test: test_diagnostic_flags_skip_compaction verifies all four flags skip compaction

Verification

Fixes #3984

Diagnostic modes (--check, --exit-code, --quiet, --no-patch) derive
their value entirely from stdout and exit code. Filtering destroys
the only signal (one line per whitespace error for --check, nothing
for --exit-code), producing 'failure with no reason attached'.

Fixes rtk-ai#3984

Signed-off-by: Yunare Maia <yunare@gmail.com>
@CLAassistant

CLAassistant commented Sep 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working git labels Sep 11, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes a bug in RTK's git diff compaction where diagnostic flags (--check, --exit-code, --quiet, --no-patch) had their output filtered by the compact-diff feature, destroying the only signal these modes provide (stdout content and exit code). Adds an is_diagnostic gate that routes these flags through the existing unfiltered passthrough path, with a test covering all four flags.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #3984


Analyzed automatically by wshm · This is an automated analysis, not a human review.

@yunaremaia

Copy link
Copy Markdown
Author

Thanks @rtk-wshm-sync-bot for the triage summary — the analysis matches the fix exactly: derives its value from stdout, and RTK's compaction was destroying that signal.

CLA is pending; I'll sign it now. Maintainers: this is ready for review — one-line logic change in with a dedicated test.

@yunaremaia

Copy link
Copy Markdown
Author

Hi @rtk-ai — gentle bump on this PR (fix(git): pass through --check/--exit-code/--quiet/--no-patch unfiltered). It's mergeable and CLA is signed. Would appreciate a review when you have a moment. Thanks!

@KuSh

KuSh commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the fix and the clear reproduction. This landed on develop through #3681 (merged 2026-09-12, commit 7931993): git diff now routes --check, --exit-code and --quiet through a raw pass-through when the tokenizer sees them, and -s/--no-patch skip compaction because there is no body to compact. Checked against git 2.53 on current develop, all four flags and their combinations print exactly what raw git prints and keep its exit code, including exit 2 for --check. Closing as already fixed; if you still see a diagnostic mode that comes back empty on develop, please comment here and it can be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working git

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk git diff --check emits no output at all, silently discarding every whitespace diagnostic

3 participants