Repository navigation
fix(git): pass through --check/--exit-code/--quiet/--no-patch unfiltered - #3988
yunaremaia wants to merge 1 commit into
Conversation
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>
📊 Automated PR Analysis
SummaryFixes 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
Linked issues: #3984 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
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. |
|
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! |
|
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. |
Summary
Diagnostic modes
--check,--exit-code,--quiet, and--no-patchderive their value entirely from stdout and exit code. RTK'sgit difffilter destroyed that signal —rtk git diff --checkreturned exit 2 with zero bytes of output, leaving agents and pre-commit scripts with "failure with no reason attached".This PR adds an
is_diagnosticgate that routes these flags through the existing passthrough path.Changes
src/cmds/git/git.rs— addedis_diagnosticflag detection inrun_diff, ANDed intowants_compactso diagnostic modes skip compactiontest_diagnostic_flags_skip_compactionverifies all four flags skip compactionVerification
cargo checkpasses (no new warnings)rtk git diff --checknow emits the same diagnostic lines as rawgit --no-pager diff --checkFixes #3984