Skip to content
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

Don't treat new folders in unpinned folders as files to dehydrate #2868

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/libsync/vfs/cfapi/vfs_cfapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ bool VfsCfApi::statTypeVirtualFile(csync_file_stat_t *stat, void *statData)
// It's a dir with a reparse point due to the placeholder info (hence the cloud tag)
// if we don't remove the reparse point flag the discovery will end up thinking
// it is a file... let's prevent it
if (isDirectory && hasReparsePoint && hasCloudTag) {
ffd->dwFileAttributes &= ~FILE_ATTRIBUTE_REPARSE_POINT;
if (isDirectory) {
if (hasReparsePoint && hasCloudTag) {
ffd->dwFileAttributes &= ~FILE_ATTRIBUTE_REPARSE_POINT;
}
return false;
} else if (isSparseFile && isPinned) {
stat->type = ItemTypeVirtualFileDownload;
Expand Down
27 changes: 27 additions & 0 deletions test/testsynccfapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,33 @@ private slots:
QCOMPARE(*vfs->pinState("onlinerenamed2/file1rename"), PinState::OnlineOnly);
}

void testEmptyFolderInOnlineOnlyRoot()
{
FakeFolder fakeFolder{ FileInfo() };
setupVfs(fakeFolder);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
ItemCompletedSpy completeSpy(fakeFolder);

auto cleanup = [&]() {
completeSpy.clear();
};
cleanup();

// OnlineOnly forced on the root
setPinState(fakeFolder.localPath(), PinState::OnlineOnly, cfapi::NoRecurse);

// No effect sync
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
cleanup();

// Add an empty folder which should propagate
fakeFolder.localModifier().mkdir("A");
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
cleanup();
}

void testIncompatiblePins()
{
FakeFolder fakeFolder{ FileInfo() };
Expand Down