fix outgoing list sort

Sat, 25 Jul 2020 13:15:04 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 25 Jul 2020 13:15:04 +0200
changeset 725
de3b2bb46492
parent 724
9c2f0072abed
child 726
8f6ad495f538

fix outgoing list sort

dav/sync.c file | annotate | diff | comparison | revisions
dav/sync.h file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Sat Jul 25 12:08:15 2020 +0200
+++ b/dav/sync.c	Sat Jul 25 13:15:04 2020 +0200
@@ -2158,14 +2158,14 @@
         ucx_map_cstr_remove(db->resources, local->path);
     }
     
-    ls_new = ucx_list_sort(ls_new, (cmp_func)resource_pathlen_cmp, NULL);
-    ls_modified = ucx_list_sort(ls_modified, (cmp_func)resource_pathlen_cmp, NULL);
-    ls_conflict = ucx_list_sort(ls_conflict, (cmp_func)resource_pathlen_cmp, NULL);
-    ls_update = ucx_list_sort(ls_update, (cmp_func)resource_pathlen_cmp, NULL);
-    ls_delete = ucx_list_sort(ls_delete, (cmp_func)resource_pathlen_cmp, NULL);
-    ls_move = ucx_list_sort(ls_move, (cmp_func)resource_pathlen_cmp, NULL);
-    ls_copy = ucx_list_sort(ls_copy, (cmp_func)resource_pathlen_cmp, NULL);
-    ls_mkcol = ucx_list_sort(ls_mkcol, (cmp_func)resource_pathlen_cmp, NULL);
+    ls_new = ucx_list_sort(ls_new, (cmp_func)resource_path_cmp, NULL);
+    ls_modified = ucx_list_sort(ls_modified, (cmp_func)resource_path_cmp, NULL);
+    ls_conflict = ucx_list_sort(ls_conflict, (cmp_func)resource_path_cmp, NULL);
+    ls_update = ucx_list_sort(ls_update, (cmp_func)resource_path_cmp, NULL);
+    ls_delete = ucx_list_sort(ls_delete, (cmp_func)resource_path_cmp, NULL);
+    ls_move = ucx_list_sort(ls_move, (cmp_func)resource_path_cmp, NULL);
+    ls_copy = ucx_list_sort(ls_copy, (cmp_func)resource_path_cmp, NULL);
+    ls_mkcol = ucx_list_sort(ls_mkcol, (cmp_func)resource_path_cmp, NULL);
     
     if(outgoing) {
         print_outgoing(
@@ -3391,6 +3391,11 @@
     }
 }
 
+int resource_path_cmp(LocalResource *res1, LocalResource *res2, void *n) {
+    return strcmp(res1->path, res2->path);
+}
+
+
 DavResource *versioning_simple_find(DavResource *res, const char *version) {
     char *vcol_href = dav_get_string_property_ns(res, DAV_NS, VERSION_PATH_PROPERTY);
     if(!vcol_href) {
--- a/dav/sync.h	Sat Jul 25 12:08:15 2020 +0200
+++ b/dav/sync.h	Sat Jul 25 13:15:04 2020 +0200
@@ -176,6 +176,7 @@
 size_t resource_get_blocksize(SyncDirectory *dir, LocalResource *local, DavResource *res, off_t filesize);
 
 int resource_pathlen_cmp(LocalResource *res1, LocalResource *res2, void *n);
+int resource_path_cmp(LocalResource *res1, LocalResource *res2, void *n);
 
 DavResource *versioning_simple_find(DavResource *res, const char *version);
 DavResource *versioning_deltav_find(DavResource *res, const char *version);

mercurial