From a4dbf5942c09f1cf425c46724d7eef2c3c6aae1b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 12 Sep 2014 17:22:02 +0200 Subject: [PATCH] owncloudcmd: restart the sync if required Fixes #2038 --- csync/tests/ownCloud/t7.pl | 4 ---- src/owncloudcmd/owncloudcmd.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/csync/tests/ownCloud/t7.pl b/csync/tests/ownCloud/t7.pl index 8a2eb204b..869372fce 100755 --- a/csync/tests/ownCloud/t7.pl +++ b/csync/tests/ownCloud/t7.pl @@ -176,8 +176,6 @@ system("sqlite3 " . localDir().'.csync_journal.db .dump'); #new directory should be uploaded system("mv " . localDir().'readonlyDirectory_PERM_M_/subdir_PERM_CK_ ' . localDir().'normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_' ); -# two syncs may be necessary for now: https://github.com/owncloud/mirall/issues/2038 -csync(); csync(); system("sqlite3 " . localDir().'.csync_journal.db .dump'); assertCsyncJournalOk(localDir()); @@ -209,8 +207,6 @@ system("mv " . localDir().'readonlyDirectory_PERM_M_/subdir_PERM_CK_ ' . localDi #2. move a directory from read to read only (move the directory from previous step) system("mv " . localDir().'normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_ ' . localDir().'readonlyDirectory_PERM_M_/moved_PERM_CK_' ); -# two syncs may be necessary for now: https://github.com/owncloud/mirall/issues/2038 -csync(); csync(); assertCsyncJournalOk(localDir()); diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp index 1f5e80ebb..543717be4 100644 --- a/src/owncloudcmd/owncloudcmd.cpp +++ b/src/owncloudcmd/owncloudcmd.cpp @@ -161,6 +161,8 @@ int main(int argc, char **argv) { account.setSslErrorHandler(sslErrorHandler); AccountManager::instance()->setAccount(&account); +restart_sync: + CSYNC *_csync_ctx; if( csync_create( &_csync_ctx, options.source_dir.toUtf8(), options.target_url.toUtf8()) < 0 ) { @@ -238,6 +240,11 @@ int main(int argc, char **argv) { ne_sock_exit(); + if (engine.isAnotherSyncNeeded()) { + qDebug() << "Restarting Sync, because another sync is needed"; + goto restart_sync; + } + return 0; }