Skip to content

Maximize cached diff reuse to eliminate redundant directory traversals (#43)#44

Merged
dsaenztagarro merged 1 commit into
masterfrom
43-maximize-cached-diff-reuse
Apr 7, 2026
Merged

Maximize cached diff reuse to eliminate redundant directory traversals (#43)#44
dsaenztagarro merged 1 commit into
masterfrom
43-maximize-cached-diff-reuse

Conversation

@dsaenztagarro
Copy link
Copy Markdown
Owner

Summary

Eliminates two redundant full directory traversals per mapping in force mode by reusing data already computed during the diff phase. Also skips the orphan preview scan when no differences exist.

Closes #43

Changes

Code

  • DirectoryDiffer: Build source index during first walk; remove build_source_index method
  • Diff: Add removal_rel_paths field for relative removal paths
  • FileTransfer: Accept removals: keyword; new remove_precomputed_files method; backward-compatible fallback to cleanup_folder
  • MappingsTransfer: Pair diffs with mappings in transfer_mappings; gate show_orphan_preview behind has_differences?

Tests

  • 4 new examples for pre-computed removals and removal_rel_paths
  • Updated FileTransfer.new mocks in pull/push specs for new keyword arg

Test plan

  • bundle exec rspec — 552 examples, 0 failures
  • bundle exec rubocop — passed (pre-commit hook)
  • Coverage: 96.64% line, 83.27% branch (above 95%/80% minimums)

@dsaenztagarro dsaenztagarro merged commit 4203f9a into master Apr 7, 2026
0 of 2 checks passed
@dsaenztagarro dsaenztagarro deleted the 43-maximize-cached-diff-reuse branch April 7, 2026 20:29
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.

Maximize cached diff reuse to eliminate redundant directory traversals

1 participant