# HG changeset patch # User Olaf Wintermann # Date 1555833287 -7200 # Node ID caf23cf7f96d62f6dfe5847f338d8211aaf6ef71 # Parent c80d5730c00b386791e66753626e051a7ed8281b separate link changes from normal changes and create links after downloads diff -r c80d5730c00b -r caf23cf7f96d dav/scfg.h --- 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; diff -r c80d5730c00b -r caf23cf7f96d dav/sync.c --- 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 { diff -r c80d5730c00b -r caf23cf7f96d dav/sync.h --- a/dav/sync.h Sun Apr 21 09:41:05 2019 +0200 +++ b/dav/sync.h Sun Apr 21 09:54:47 2019 +0200 @@ -80,6 +80,7 @@ REMOTE_CHANGE_CONFLICT_LOCAL_MODIFIED, REMOTE_CHANGE_METADATA, REMOTE_CHANGE_MKDIR, + REMOTE_CHANGE_LINK }; typedef enum RemoteChangeType RemoteChangeType;