Skip to content

CopyJob: fix total number of files/dirs in progress dialog (when moving)

David Faure requested to merge work/dfaure/copyjob_totals_when_moving into master

When moving files/dirs, we first try a "direct renaming", which can work when src and dest are on the same partition. In that case every URL is counted as a file (we don't even bother finding out if it's a file or directory). But if it fails, we then go for the full stat+list+copy+del.

So the total number of files is:

  • the number of files direct-renamed, or skipped during direct-renaming
  • plus the number of files found during the recursive listing of the second case

Why "plus" rather than "or"? For a given copyjob, both can happen because direct-renaming will tell us right away if a dest exists, even if it's on another partition, so we can have e.g. one file skipped during direct-rename + one file handled by copy+del. JobTest::moveFileDestAlreadyExists tests this case.

Also the unittest was broken by the fact that slotReport() wasn't necessarily called during STATE_RENAMING. Do report total files when we're about to rename the first file.

Merge request reports