fix that knowledge about resource existence was fucked up by versioning_begin

Sun, 21 Apr 2019 11:06:16 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 21 Apr 2019 11:06:16 +0200
changeset 584
7fb81fd429b2
parent 583
ec0ec7908b7d
child 585
41368a355222

fix that knowledge about resource existence was fucked up by versioning_begin

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Sun Apr 21 10:53:21 2019 +0200
+++ b/dav/sync.c	Sun Apr 21 11:06:16 2019 +0200
@@ -3140,7 +3140,7 @@
 #define VBEGIN_ERROR_MOVE      2
 #define VBEGIN_ERROR_PROPPATCH 3
 #define VBEGIN_ERROR_CHECKOUT  4
-int versioning_begin(SyncDirectory *dir, DavResource *res) {
+int versioning_begin(SyncDirectory *dir, DavResource *res, int *exists) {
     int ret = 0;
     
     if(dir->versioning->type == VERSIONING_SIMPLE && res->exists) {
@@ -3209,6 +3209,10 @@
                     ret = VBEGIN_ERROR_MOVE;
                     break;
                 }
+            } else {
+                // tell the caller the resource does not exist anymore at
+                // the original location
+                *exists = 0;
             }
         }
 
@@ -3592,7 +3596,7 @@
     // and sets res->exists
     int exists = res->exists;
     if(dir->versioning && dir->versioning->always && !issplit) {
-        int err = versioning_begin(dir, res);
+        int err = versioning_begin(dir, res, &exists);
         if(err) {
             fprintf(stderr, "Cannot store version for resource: %s\n", res->href);
             free(local_path);

mercurial