Rework file numbering
Summary:
Previously we looped though every match and checked the filesystem every
iteration. Now we do it only once which should result in better performance. I
also added a test case that shows that the old method was broken, too.
Test Plan: run tests
Reviewers: Spectacle, ngraham
Reviewed By: Spectacle, ngraham
Subscribers: ngraham
Tags: Spectacle
Differential Revision: https://phabricator.kde.org/D28315