Repository navigation
fix(git): pass through diff diagnostic modes like --check unfiltered (#3984) - #3989
anujsingh-cse wants to merge 1 commit into
Conversation
📊 Automated PR Analysis
SummaryFixes Review Checklist
Linked issues: #3984 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
Thanks for the fix and the repro. The same behaviour landed on develop through #3681 (merged 2026-09-12, commit 7931993): --check, --exit-code and --quiet are classified by the tokenizer as raw-shape flags and go straight through with git's stdout, stderr and exit code, and -s/--no-patch skip compaction since there is no body to compact. Verified on current develop with git 2.53: rtk git diff --check prints the whitespace report and exits 2, and the combined forms match raw git byte for byte. Closing as already fixed; if a diagnostic mode still comes back empty for you on develop, please comment here and it can be reopened. |
Closes #3984
Problem
rtk git diff --checkemits no output at all — it silently discards every whitespace diagnostic.git diff --checkis a diagnostic mode whose entire value is its stdout (one line per whitespace error, exit code 2). Under rtk, stdout was empty while exit 2 was preserved, so an agent or pre-commit script sees a failure with no reason attached.Repro:
Fix
Treat
--check(plus the sibling diagnostic modes--exit-code,--quiet,--no-patch) as pass-through modes in thegit difffilter. Awants_diagnostic_outputhelper detects these flags, andrun_diffroutes them to a raw pass-through branch that emits stdout and stderr verbatim and preserves the exit code — no--statrewrite and no compaction.Tests
test_wants_diagnostic_output_detects_diff_modes— all four flags detectedtest_wants_diagnostic_output_ignores_normal_diff_args—--stat,--numstat, a path, and empty args are not diagnosticcargo fmt --checkandcargo clippy --all-targetsclean; 478 git tests pass. Verified end-to-end:rtk git diff --checknow prints the trailing-whitespace diagnostics and preserves exit code 2.