Sun, 21 Apr 2019 09:54:47 +0200
separate link changes from normal changes and create links after downloads
dav/scfg.h | file | annotate | diff | comparison | revisions | |
dav/sync.c | file | annotate | diff | comparison | revisions | |
dav/sync.h | file | annotate | diff | comparison | revisions |
--- a/dav/scfg.h Sun Apr 21 09:41:05 2019 +0200 +++ b/dav/scfg.h Sun Apr 21 09:54:47 2019 +0200 @@ -53,6 +53,9 @@ #define DEFAULT_TAG_XATTR "tags" #define MACOS_TAG_XATTR "com.apple.metadata:_kMDItemUserTags" +#define SYNC_SYMLINK(dir) \ + (((dir)->symlink & SYNC_SYMLINK_STORE) == SYNC_SYMLINK_STORE) + typedef struct TagConfig TagConfig; typedef struct Versioning Versioning; typedef struct SplitConfig SplitConfig;
--- a/dav/sync.c Sun Apr 21 09:41:05 2019 +0200 +++ b/dav/sync.c Sun Apr 21 09:54:47 2019 +0200 @@ -674,6 +674,10 @@ res_mkdir = ucx_list_append(res_mkdir, res); break; } + case REMOTE_CHANGE_LINK: { + res_link = ucx_list_append(res_link, res); + break; + } } // remove every server resource from dbres @@ -807,6 +811,7 @@ // download all new, modified and conflict files UcxList *download = ucx_list_concat(res_modified, res_conflict); download = ucx_list_concat(res_new, download); + download = ucx_list_concat(download, res_link); UCX_FOREACH(elm, download) { DavResource *res = elm->data; if(sync_shutdown) { @@ -952,6 +957,9 @@ LocalResource *local = ucx_map_cstr_get(db->resources, res->path); char *local_path = create_local_path(dir, res->path); + char *link = SYNC_SYMLINK(dir) ? + dav_get_string_property_ns(res, DAV_NS, "link") : NULL; + SYS_STAT s; DavBool exists = 1; if(sys_stat(local_path, &s)) { @@ -971,10 +979,10 @@ } else if(local) { DavBool nochange = FALSE; char *content_hash = sync_get_content_hash(res); - char *link = dav_get_string_property_ns(res, DAV_NS, "link"); - if(nullstrcmp(link, local->link_target)) { - ret = REMOTE_CHANGE_MODIFIED; + if(SYNC_SYMLINK(dir) && nullstrcmp(link, local->link_target)) { + ret = REMOTE_CHANGE_LINK; + nochange = TRUE; } else if(content_hash && local->hash) { if(!strcmp(content_hash, local->hash)) { nochange = TRUE; @@ -996,6 +1004,12 @@ } ret = type; } + } else if(link) { + if(type == REMOTE_CHANGE_CONFLICT_LOCAL_MODIFIED) { + ret = REMOTE_CHANGE_CONFLICT_LOCAL_MODIFIED; + } else { + ret = REMOTE_CHANGE_LINK; + } } else if(exists) { ret = type; } else {