Synchronizer: Fix the feature of excluding folders
About the Folders are ignored in the exclude list of Synchronizer bug report:
In the tests that I performed all excluded folder were ignored, too (as it happened to Davide Gianforte). An effect of the problem was found inside:
void Synchronizer::compareDirectory(SynchronizerFileItem *parent, SynchronizerDirList * left_directory,
SynchronizerDirList * right_directory, const QString &leftDir,
const QString &rightDir)
More concretely:
- In one case, in:
if (excludedPaths.contains(leftDir.isEmpty() ? left_file_name : leftDir + '/' + left_file_name))
continue;
the content of excludedPaths
was:
file:///home/user/tmp/1/test5/folder2
but the content of left_file_name
was:
folder2
therefore the continue
was never executed, and so that folder was never excluded.
- In other case, in:
if (excludedPaths.contains(rightDir.isEmpty() ? file_name : rightDir + '/' + file_name))
continue;
the content of excludedPaths
was:
file:///home/user/tmp/1/test5B/folder2
but the content of file_name
was:
folder2
therefore the continue
was never executed, and so that folder was never excluded.
The code of the present review request was tried and then the bug effects were not seen, but I'm not a Synchronizer expert and I wanted to ask for other points of view.
TEST PLAN
Execute:
mkdir -p /tmp/krTest/1/"A folder"
mkdir -p /tmp/krTest/1/"B folder"
echo "sampleA" > /tmp/krTest/1/"A folder"/sample.text
cp -a /tmp/krTest/1 /tmp/krTest/2
echo "sampleA2" > /tmp/krTest/1/"A folder"/sample.text
Launch Synchronizer to compare /tmp/krTest/1
and /tmp/krTest/2
. Check that this difference is found:
A folder A folder
sample.text sample.text
Go to the General tab, in the "Do not search in" list write:
/tmp/krTest/1/A folder
Compare again, check that now no differences are seen.
Go to the General tab, press the button that exists at the right of /tmp/krTest/1/A folder
, check that in the list now it's seen:
A folder
Compare again, check that no differences are seen.
Go to the General tab, remove the entry
A folder
from the exclusion list. Compare again and check that this difference is found again:
A folder A folder
sample.text sample.text
Execute:
mkdir "/tmp/krTest/1/A folder/A folder"
cp -a "/tmp/krTest/1/A folder/sample.text" "/tmp/krTest/1/A folder/A folder"
mkdir "/tmp/krTest/1/A folder/A folder/A folder"
cp -a "/tmp/krTest/1/A folder/A folder/sample.text" "/tmp/krTest/1/A folder/A folder/A folder"
mkdir "/tmp/krTest/2/A folder/A folder"
cp -a "/tmp/krTest/2/A folder/sample.text" "/tmp/krTest/2/A folder/A folder"
mkdir "/tmp/krTest/2/A folder/A folder/A folder"
cp -a "/tmp/krTest/2/A folder/A folder/sample.text" "/tmp/krTest/2/A folder/A folder/A folder"
Compare excluding /tmp/krTest/1/A folder/A folder
and check that the results are the expected ones.
Compare excluding /tmp/krTest/1/A folder/A folder/A folder
, etc. and check that the results are the expected ones.
Perform similar tests, for example with more folders to be excluded.
FIXED: [ 364838 ] Folders are ignored in the exclude list of Synchronizer
BUG: 364838