Repository navigation
fix(diff): honor positional file filter with --change - #120
Merged
Merged
Conversation
`atomic diff --change <hash> <file>` silently ignored the trailing file filter and always showed every file touched by the change. Root cause: Diff::run short-circuits into show_change_diff when --change is set, and none of the three change-diff code paths (git-import metadata, semantic FileOps, legacy computed fallback) ever consulted self.files. Fix: add a file_matches_filter helper (exact repo-relative match, tolerating a leading ./) and a filter_file_diffs helper that prunes computed FileDiffs and rebuilds the aggregate stats, then wire them into all three paths. The legacy computed path filters the file list up front to avoid the expensive before/after content retrieval for filtered-out files.
graywolf336
force-pushed
the
fix/diff-change-file-filter
branch
from
July 21, 2026 18:19
46c2c56 to
934260d
Compare
graywolf336
marked this pull request as draft
July 21, 2026 18:19
graywolf336
marked this pull request as ready for review
July 21, 2026 18:20
geekgonecrazy
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
atomic diff --change <hash> <file>silently ignored the trailing file filter and always showed every file touched by the change.Root cause
Diff::runshort-circuits intoshow_change_diffwhen--changeis set (command.rs), and none of the three change-diff code paths inhelpers.rsever consultedself.files:build_git_import_file_diffs)show_change_diff_from_file_ops)show_change_diff_computed)Fix
file_matches_filter()— exact repo-relative match, tolerating a leading./filter_file_diffs()— prunes computedFileDiffs and rebuilds aggregate stats from surviving entriesVerification
Reproduced against a change touching two files:
Also verified: no filter still shows all files, non-matching filter prints "No changes detected",
--stattotals reflect only filtered files.Added 7 unit tests covering the filter helpers. Full
atomic-clidiff test suite passes (135 tests),cargo fmt --checkandclippyclean.