Excludes: Optimize Desktop.ini check

This commit is contained in:
Christian Kamm 2017-11-28 08:50:14 +01:00 committed by ckamm
parent 7ab127ad53
commit 5d668eca40
2 changed files with 8 additions and 4 deletions

View file

@ -310,10 +310,12 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QList<QByteArray> &exclud
#endif
/* We create a desktop.ini on Windows for the sidebar icon, make sure we don't sync them. */
rc = csync_fnmatch("Desktop.ini", bname, 0);
if (rc == 0) {
match = CSYNC_FILE_SILENTLY_EXCLUDED;
goto out;
if (blen == 11) {
rc = csync_fnmatch("Desktop.ini", bname, 0);
if (rc == 0) {
match = CSYNC_FILE_SILENTLY_EXCLUDED;
goto out;
}
}
if (!OCC::Utility::shouldUploadConflictFiles()) {

View file

@ -258,6 +258,8 @@ static void check_csync_excluded_traversal(void **)
assert_int_equal(check_file_traversal(".sync_5bdd60bdfcfa.db-shm"), CSYNC_FILE_SILENTLY_EXCLUDED);
assert_int_equal(check_file_traversal("subdir/.sync_5bdd60bdfcfa.db"), CSYNC_FILE_SILENTLY_EXCLUDED);
/* Other builtin excludes */
assert_int_equal(check_file_traversal("foo/Desktop.ini"), CSYNC_FILE_SILENTLY_EXCLUDED);
/* pattern ]*.directory - ignore and remove */
assert_int_equal(check_file_traversal("my.~directory"), CSYNC_FILE_EXCLUDE_AND_REMOVE);