[indexcleaner] Avoid removing included folders below excluded ones

Authored by bruns on Apr 6 2019, 10:40 AM.



This fixes a regression introduced with commit e58804bf9eb8
("React to config updates inside indexer").

The recursion should stop when it reaches an explicitly included folder,
thus pass shouldDelete also into the iteration for excluded folders.
The current unconditional removal causes recurrent indexing of included
subtrees on each login.

Do a depth first walk, and after returning check if there are any
children left. Only delete the folder if it is empty. Otherwise, the
directory tree structure has dangling subtrees.

Test Plan

configure an includeFolder below an excludeFolder
start balooctl monitor
restart baloo_file
files below the includeFolder should not be needed to be reindexed

Diff Detail

R293 Baloo
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Apr 6 2019, 10:40 AM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptApr 6 2019, 10:40 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Apr 6 2019, 10:40 AM
bruns added a comment.Apr 6 2019, 7:01 PM

As this fixes a regression introduced between KF 5.56 and KF 5.57, it would be nice to have this fixed prior to tagging.

ngraham accepted this revision.Apr 6 2019, 11:05 PM

Very nice catch. Can confirm that it fixes this annoying issue. Please land prior to tagging.

This revision is now accepted and ready to land.Apr 6 2019, 11:05 PM
This revision was automatically updated to reflect the committed changes.