Merge branch 'master' into upstream/pr/6688

This commit is contained in:
Roeland Jago Douma 2018-10-24 07:29:10 +02:00 committed by GitHub
commit 091c4fd9b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 18 deletions

View file

@ -198,7 +198,7 @@ X-GNOME-Autostart-Delay=3
# Translations # Translations
Comment[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation Comment[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation
Icon[de]=@APPLICATION_ICON_NAME@ Icon[de_DE]=@APPLICATION_ICON_NAME@
Name[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation Name[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation
GenericName[de]=Synchronisationsordner GenericName[de_DE]=Synchronisationsordner

View file

@ -204,6 +204,10 @@ static void _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx)
if( !cur->file_id.isEmpty() ) { if( !cur->file_id.isEmpty() ) {
other->file_id = cur->file_id; other->file_id = cur->file_id;
} }
if (ctx->current == LOCAL_REPLICA) {
// Keep the local mtime.
other->modtime = cur->modtime;
}
other->inode = cur->inode; other->inode = cur->inode;
cur->instruction = CSYNC_INSTRUCTION_NONE; cur->instruction = CSYNC_INSTRUCTION_NONE;
// We have consumed 'other': exit this loop to not consume another one. // We have consumed 'other': exit this loop to not consume another one.

View file

@ -576,6 +576,51 @@ private slots:
//QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); //QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
} }
} }
// https://github.com/owncloud/client/issues/6629#issuecomment-402450691
// When a file is moved and the server mtime was not in sync, the local mtime should be kept
void testMoveAndMTimeChange()
{
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
int nPUT = 0;
int nDELETE = 0;
int nGET = 0;
int nMOVE = 0;
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *) {
if (op == QNetworkAccessManager::PutOperation)
++nPUT;
if (op == QNetworkAccessManager::DeleteOperation)
++nDELETE;
if (op == QNetworkAccessManager::GetOperation)
++nGET;
if (req.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE")
++nMOVE;
return nullptr;
});
// Changing the mtime on the server (without invalidating the etag)
fakeFolder.remoteModifier().find("A/a1")->lastModified = QDateTime::currentDateTimeUtc().addSecs(-50000);
fakeFolder.remoteModifier().find("A/a2")->lastModified = QDateTime::currentDateTimeUtc().addSecs(-40000);
// Move a few files
fakeFolder.remoteModifier().rename("A/a1", "A/a1_server_renamed");
fakeFolder.localModifier().rename("A/a2", "A/a2_local_renamed");
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(nGET, 0);
QCOMPARE(nPUT, 0);
QCOMPARE(nMOVE, 1);
QCOMPARE(nDELETE, 0);
// Another sync should do nothing
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(nGET, 0);
QCOMPARE(nPUT, 0);
QCOMPARE(nMOVE, 1);
QCOMPARE(nDELETE, 0);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
}
}; };
QTEST_GUILESS_MAIN(TestSyncMove) QTEST_GUILESS_MAIN(TestSyncMove)

View file

@ -2274,7 +2274,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/libsync/propagateremotemove.cpp" line="141"/> <location filename="../src/libsync/propagateremotemove.cpp" line="141"/>
<source>The file was renamed but is part of a read only share. The original file was restored.</source> <source>The file was renamed but is part of a read only share. The original file was restored.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/libsync/propagateremotemove.cpp" line="158"/> <location filename="../src/libsync/propagateremotemove.cpp" line="158"/>
@ -2355,7 +2355,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/libsync/propagateuploadv1.cpp" line="191"/> <location filename="../src/libsync/propagateuploadv1.cpp" line="191"/>
<source>The file was edited locally but is part of a read only share. It is restored and your edit is in the conflict file.</source> <source>The file was edited locally but is part of a read only share. It is restored and your edit is in the conflict file.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/libsync/propagateuploadv1.cpp" line="205"/> <location filename="../src/libsync/propagateuploadv1.cpp" line="205"/>
@ -2581,7 +2581,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/sharedialog.ui" line="28"/> <location filename="../src/gui/sharedialog.ui" line="28"/>
<source>share label</source> <source>share label</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/gui/sharedialog.ui" line="14"/> <location filename="../src/gui/sharedialog.ui" line="14"/>
@ -2596,7 +2596,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/sharedialog.cpp" line="109"/> <location filename="../src/gui/sharedialog.cpp" line="109"/>
<source>%1 Sharing</source> <source>%1 Sharing</source>
<translation>%1 </translation> <translation>%1 </translation>
</message> </message>
<message> <message>
<location filename="../src/gui/sharedialog.cpp" line="84"/> <location filename="../src/gui/sharedialog.cpp" line="84"/>
@ -2639,7 +2639,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/sharelinkwidget.ui" line="14"/> <location filename="../src/gui/sharelinkwidget.ui" line="14"/>
<source>Share NewDocument.odt</source> <source>Share NewDocument.odt</source>
<translation> NewDocument.odt</translation> <translation> NewDocument.odt</translation>
</message> </message>
<message> <message>
<location filename="../src/gui/sharelinkwidget.ui" line="276"/> <location filename="../src/gui/sharelinkwidget.ui" line="276"/>
@ -2710,12 +2710,12 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/sharelinkwidget.cpp" line="93"/> <location filename="../src/gui/sharelinkwidget.cpp" line="93"/>
<source>Link shares have been disabled</source> <source>Link shares have been disabled</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/gui/sharelinkwidget.cpp" line="107"/> <location filename="../src/gui/sharelinkwidget.cpp" line="107"/>
<source>Create public link share</source> <source>Create public link share</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/gui/sharelinkwidget.cpp" line="168"/> <location filename="../src/gui/sharelinkwidget.cpp" line="168"/>
@ -2777,7 +2777,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/sharelinkwidget.cpp" line="459"/> <location filename="../src/gui/sharelinkwidget.cpp" line="459"/>
<source>Public sh&amp;aring requires a password</source> <source>Public sh&amp;aring requires a password</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/gui/sharelinkwidget.cpp" line="477"/> <location filename="../src/gui/sharelinkwidget.cpp" line="477"/>
@ -2790,12 +2790,12 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/shareusergroupwidget.ui" line="14"/> <location filename="../src/gui/shareusergroupwidget.ui" line="14"/>
<source>Share NewDocument.odt</source> <source>Share NewDocument.odt</source>
<translation> NewDocument.odt</translation> <translation> NewDocument.odt</translation>
</message> </message>
<message> <message>
<location filename="../src/gui/shareusergroupwidget.ui" line="22"/> <location filename="../src/gui/shareusergroupwidget.ui" line="22"/>
<source>Share with users or groups ...</source> <source>Share with users or groups ...</source>
<translation> ...</translation> <translation> ...</translation>
</message> </message>
<message> <message>
<location filename="../src/gui/shareusergroupwidget.ui" line="108"/> <location filename="../src/gui/shareusergroupwidget.ui" line="108"/>
@ -2805,7 +2805,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/shareusergroupwidget.cpp" line="186"/> <location filename="../src/gui/shareusergroupwidget.cpp" line="186"/>
<source>The item is not shared with any users or groups</source> <source>The item is not shared with any users or groups</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/gui/shareusergroupwidget.cpp" line="235"/> <location filename="../src/gui/shareusergroupwidget.cpp" line="235"/>
@ -2830,7 +2830,7 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/shareusergroupwidget.cpp" line="337"/> <location filename="../src/gui/shareusergroupwidget.cpp" line="337"/>
<source>I shared something with you</source> <source>I shared something with you</source>
<translation>西</translation> <translation>西</translation>
</message> </message>
</context> </context>
<context> <context>
@ -2923,12 +2923,12 @@ It is not advisable to use it.</source>
<message> <message>
<location filename="../src/gui/socketapi.cpp" line="557"/> <location filename="../src/gui/socketapi.cpp" line="557"/>
<source>I shared something with you</source> <source>I shared something with you</source>
<translation>西</translation> <translation>西</translation>
</message> </message>
<message> <message>
<location filename="../src/gui/socketapi.cpp" line="565"/> <location filename="../src/gui/socketapi.cpp" line="565"/>
<source>Share...</source> <source>Share...</source>
<translation>...</translation> <translation>...</translation>
</message> </message>
<message> <message>
<location filename="../src/gui/socketapi.cpp" line="567"/> <location filename="../src/gui/socketapi.cpp" line="567"/>