Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kamm <mail@ckamm.de>2017-10-23 11:46:41 +0300
committerckamm <mail@ckamm.de>2017-10-24 11:54:23 +0300
commit9c7ee6ef85fbc11234b2f0bf903c9a647f4b395b (patch)
tree3e090edbc6d8fc0eb31ddba20c2b93f1ab36cde0 /test/syncenginetestutils.h
parentf3ea37508321d427674b557cd7b79659129597af (diff)
Reconcile: Rename handling fixes: duplicate file ids
When users share the same tree several times (say A/ and A/B/ are both shared) the remote tree can have several entries that have the same file id. This needs to be respected in rename detection. Also adds several tests and fixes for issues noticed during testing. See #6096
Diffstat (limited to 'test/syncenginetestutils.h')
-rw-r--r--test/syncenginetestutils.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h
index 376b47496..e6d4a395e 100644
--- a/test/syncenginetestutils.h
+++ b/test/syncenginetestutils.h
@@ -161,12 +161,15 @@ public:
FileInfo(const QString &name, qint64 size) : name{name}, isDir{false}, size{size} { }
FileInfo(const QString &name, qint64 size, char contentChar) : name{name}, isDir{false}, size{size}, contentChar{contentChar} { }
FileInfo(const QString &name, const std::initializer_list<FileInfo> &children) : name{name} {
- QString p = path();
- for (const auto &source : children) {
- auto &dest = this->children[source.name] = source;
- dest.parentPath = p;
- dest.fixupParentPathRecursively();
- }
+ for (const auto &source : children)
+ addChild(source);
+ }
+
+ void addChild(const FileInfo &info)
+ {
+ auto &dest = this->children[info.name] = info;
+ dest.parentPath = path();
+ dest.fixupParentPathRecursively();
}
void remove(const QString &relativePath) override {
@@ -952,6 +955,11 @@ private:
} else {
QFile f{diskChild.filePath()};
f.open(QFile::ReadOnly);
+ auto content = f.read(1);
+ if (content.size() == 0) {
+ qWarning() << "Empty file at:" << diskChild.filePath();
+ continue;
+ }
char contentChar = f.read(1).at(0);
templateFi.children.insert(diskChild.fileName(), FileInfo{diskChild.fileName(), diskChild.size(), contentChar});
}