-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyncEngine: SelectiveSync: Remove local files of undelected folder de… #5822
Conversation
src/libsync/syncengine.cpp
Outdated
@@ -1179,6 +1180,34 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) | |||
if ((*it)->_isDirectory) { | |||
for (SyncFileItemVector::iterator it_next = it + 1; it_next != syncItems.end() && (*it_next)->_file.startsWith(path); ++it_next) { | |||
it = it_next; | |||
if ((*it)->_direction != SyncFileItem::Up && (*it)->_instruction == CSYNC_INSTRUCTION_REMOVE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why != Up
and not == Down
? I'd be more comfortable with this pointing specifically at local removes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Add a comment before the if
along these lines:
We want to ignore almost all instructions for items inside selective-sync excluded folders.
The exception are DOWN/REMOVE actions that remove local files and folders that are
guaranteed to be up-to-date with their server copies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just using the same pattern as above. Normally, conflicts should not happen there. But still I guess it's more clear with == Down, so i'll change it.
src/libsync/syncengine.cpp
Outdated
needle = SyncFileItemPtr::create(); | ||
needle->_file = parentDir; | ||
auto parent_it = std::lower_bound(syncItems.begin(), it, needle); | ||
if (parent_it == syncItems.end() || (*parent_it)->destination() != parentDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe at a || !(*parent_it)->_file.startsWith(path)
to ensure we're not traversing too far upwards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
I'm going to do the check slightly differently. (because path ends with '/' but we also need to do it for path itself)
break; // already changed | ||
} | ||
(*parent_it)->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA; | ||
(*parent_it)->_status = SyncFileItem::NoStatus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay to keep _errorString
set? I think some code considers finished items with a non-empty errorString an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing
…spite other modified files Issue #5783 When the directry that should be removed by selective sync contains changes, we ignore the whole sub tree instead of only ignoreing new files. We cannot ignore the whole directory, we need to ignore only the directory that do not have files to remove
43017e4
to
ff2e868
Compare
…spite other modified files
Issue #5783
When the directry that should be removed by selective sync contains changes,
we ignore the whole sub tree instead of only ignoreing new files.
We cannot ignore the whole directory, we need to ignore only the directory
that do not have files to remove