dav/sync.c

changeset 675
a8117c4feaad
parent 672
4bfe452a2665
child 679
0d352b79363a
equal deleted inserted replaced
674:92bf06a65d08 675:a8117c4feaad
843 fprintf(stderr, "resource download failed: %s\n", res->path); 843 fprintf(stderr, "resource download failed: %s\n", res->path);
844 sync_error++; 844 sync_error++;
845 } 845 }
846 } 846 }
847 847
848 // update metadata
848 UCX_FOREACH(elm, res_metadata) { 849 UCX_FOREACH(elm, res_metadata) {
849 DavResource *res = elm->data; 850 DavResource *res = elm->data;
850 if(sync_shutdown) { 851 if(sync_shutdown) {
851 break; 852 break;
852 } 853 }
1317 char *etag = dav_get_string_property(res, "D:getetag"); 1318 char *etag = dav_get_string_property(res, "D:getetag");
1318 char *content_hash = sync_get_content_hash(res); 1319 char *content_hash = sync_get_content_hash(res);
1319 1320
1320 LocalResource *local = NULL; 1321 LocalResource *local = NULL;
1321 if(copy) { 1322 if(copy) {
1323 // TODO: maybe we should not copy the whole resource
1324 // with all metadata hashes
1322 local = local_resource_copy(content, res->path); 1325 local = local_resource_copy(content, res->path);
1323 } else { 1326 } else {
1324 // reuse previous LocalResource (content) 1327 // reuse previous LocalResource (content)
1325 // remove it from db->resources, change path and put it back 1328 // remove it from db->resources, change path and put it back
1326 local = ucx_map_cstr_remove(db->resources, content->path); 1329 local = ucx_map_cstr_remove(db->resources, content->path);
3360 } 3363 }
3361 // TODO: free local_tags 3364 // TODO: free local_tags
3362 } 3365 }
3363 3366
3364 if(!store_tags) { 3367 if(!store_tags) {
3368 nullfree(local->remote_tags_hash);
3369 local->remote_tags_hash = remote_hash;
3365 return 0; 3370 return 0;
3366 } 3371 }
3367 3372
3368 int ret = sync_store_tags_local(dir, local, path, tags); 3373 int ret = sync_store_tags_local(dir, local, path, tags);
3369 if(!ret) { 3374 if(!ret) {

mercurial