diff -r 060a8cda7f62 -r 2f85df8cd35e dav/sync.c --- a/dav/sync.c Thu Mar 28 11:54:27 2019 +0100 +++ b/dav/sync.c Thu Mar 28 14:18:54 2019 +0100 @@ -284,6 +284,13 @@ free(rpath.ptr); } + // versioning filter + if (dir->versioning) { + if(util_path_isrelated(dir->versioning->collection, res_path)) { + return 1; + } + } + // include/exclude filter UCX_FOREACH(inc, dir->include) { regex_t* pattern = (regex_t*) inc->data; @@ -517,7 +524,7 @@ } int ret = 0; - DavResource *ls = dav_query(sn, "select D:getetag,idav:status,idav:tags,idav:finfo,idav:xattributes,idav:content-hash from / with depth = infinity"); + DavResource *ls = dav_query(sn, "select D:getetag,idav:status,idav:tags,idav:finfo,idav:xattributes,`idav:content-hash` from / with depth = infinity"); if(!ls) { print_resource_error(sn, "/"); if(locked) { @@ -815,6 +822,8 @@ return REMOTE_NO_CHANGE; } + DavBool issplit = dav_get_property(res, "idav:split") ? TRUE : FALSE; + RemoteChangeType type = cmd_getoption(a, "conflict") ? REMOTE_CHANGE_MODIFIED : REMOTE_CHANGE_CONFLICT_LOCAL_MODIFIED; @@ -833,13 +842,19 @@ } RemoteChangeType ret = REMOTE_NO_CHANGE; - if(res->iscollection) { + if(res->iscollection && !issplit) { if(!exists) { ret = REMOTE_CHANGE_MKDIR; } } else if(local) { DavBool nochange = FALSE; - if(local->etag) { + char *content_hash = sync_get_content_hash(res); + + if(content_hash || local->hash) { + if(!nullstrcmp(content_hash, local->hash)) { + nochange = TRUE; + } + } else if(local->etag) { sstr_t e = sstr(etag); if(sstrprefix(e, S("W/"))) { e = sstrsubs(e, 2); @@ -958,10 +973,6 @@ if(ret == 0) { (*counter)++; - - if(sync_store_metadata(dir, tmp_path, local, res)) { - fprintf(stderr, "Cannot store metadata: %s\n", path); - } if(dir->trash && dir->backuppull) { move_to_trash(dir, local_path); @@ -989,6 +1000,10 @@ local->path = strdup(path); ucx_map_cstr_put(db->resources, local->path, local); } + + if(sync_store_metadata(dir, local_path, local, res)) { + fprintf(stderr, "Cannot store metadata: %s\n", path); + } if(local->etag) { free(local->etag);