Commit b365076
committed
Bulk-skip pre-known conflicts under Skip-all for copy and move
TransferDialog already runs a pre-flight `scan_for_conflicts` and surfaces the result as "N files already exist". Previously that information was thrown away once the user clicked Copy: the backend re-discovered each conflict serially via per-file `dest.get_metadata` between (slow) copies, so under Skip-all the progress bar trickled by 1 per conflict instead of jumping to N immediately. For a 1046-file MTP→SMB copy with ~100 scattered conflicts this looked like the bar was stuck for many minutes while iteration crept through copies in between.
Now the FE forwards the full conflicting-name list as `preKnownConflicts` on `VolumeCopyConfig` / `WriteOperationConfig`. The BE builds a `HashSet<PathBuf>` of source paths whose filename matches and, under Skip mode, bulk-accounts them in one shot before the main loop: bumps `files_done`/`bytes_done`, emits one progress event, and the main loop `continue`s past them. Other modes (Stop / Overwrite / Rename) ignore the list — Stop still emits per-file conflict events, Overwrite still overwrites.
Three paths now apply it: `copy_volumes_with_progress` (cross-volume copy), `move_between_volumes` + `move_within_same_volume` (cross-volume / same-volume move), and `copy_files_with_progress` (local↔local copy via the short-circuit in `copy_between_volumes`).
Bundled together because they share the same FE wire and the same data-safety pattern:
- The `continue` is positioned before any destructive call (no `dest` write, no `source.delete()`), so skipped files are untouched on both sides.
- Move-side per-iter `Skip` arm also picks up a latent fix: previously it `continue`d without bumping `files_done`, so the bar stalled through a run of conflicts even when "Skip all" was chosen via Stop's per-file dialog.
`resolve_volume_conflict` now accepts `source_size_hint` / `dest_size_hint`. The copy path supplies real hints (source from `source_hints`, dest from `dest_meta`); the move path passes `None` for source (no scan phase) but supplies the dest hint. Before the hints, an MTP source's `scan_for_copy` listed the whole parent dir per conflict — an 18s stall before the very first conflict prompt on a 1046-file directory.
TransferDialog now displays the true conflict count instead of capping at `maxConflictsToShow` (the cap was only meaningful for the per-row conflict list, which this dialog doesn't actually render). The "100+" misdirection is gone.
Tests (in `volume_copy_tests.rs`):
- `test_pre_known_conflicts_are_bulk_skipped_upfront` — happy path, concurrent loop
- `test_stop_mode_does_not_bulk_skip_pre_known_conflicts` — Stop still emits per-file prompts
- `test_pre_known_conflicts_ignored_outside_skip_mode` — Overwrite proceeds with overwrite
- `test_pre_known_conflicts_with_stale_entries_is_safe` — stale or non-matching names can't crash or skip the wrong files
- `test_pre_known_conflicts_bulk_skip_on_real_local_volumes` — `LocalPosixVolume` on tmpfile (catches `InMemoryVolume`-only assumptions)
- `test_skipped_files_count_toward_progress` — per-iter skip accounting (Bug 2 from earlier in this thread)
- `test_stop_conflict_does_not_rescan_source_when_hint_provided` — size-hint path doesn't re-scan1 parent f052465 commit b365076
15 files changed
Lines changed: 1249 additions & 44 deletions
File tree
- apps/desktop
- src-tauri/src/file_system/write_operations
- src/lib
- file-explorer
- pane
- file-operations/transfer
- ipc
- tauri-commands
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 70 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
182 | 250 | | |
183 | 251 | | |
184 | 252 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
570 | 574 | | |
571 | 575 | | |
572 | 576 | | |
| |||
580 | 584 | | |
581 | 585 | | |
582 | 586 | | |
| 587 | + | |
583 | 588 | | |
584 | 589 | | |
585 | 590 | | |
| |||
779 | 784 | | |
780 | 785 | | |
781 | 786 | | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
782 | 797 | | |
783 | 798 | | |
784 | 799 | | |
| |||
788 | 803 | | |
789 | 804 | | |
790 | 805 | | |
| 806 | + | |
791 | 807 | | |
792 | 808 | | |
793 | 809 | | |
| |||
799 | 815 | | |
800 | 816 | | |
801 | 817 | | |
| 818 | + | |
802 | 819 | | |
803 | 820 | | |
804 | 821 | | |
| |||
Lines changed: 27 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
32 | 42 | | |
33 | 43 | | |
34 | 44 | | |
| |||
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
44 | | - | |
45 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
46 | 60 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
54 | 72 | | |
55 | 73 | | |
56 | 74 | | |
| |||
0 commit comments