fixed include/exclude filter for dav-sync

Sat, 11 Oct 2014 19:05:11 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 11 Oct 2014 19:05:11 +0200
changeset 61
e9b102d5a6f6
parent 60
cdca2eef48ee
child 63
ee9da935645d

fixed include/exclude filter for dav-sync

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Mon Sep 01 17:09:18 2014 +0200
+++ b/dav/sync.c	Sat Oct 11 19:05:11 2014 +0200
@@ -109,22 +109,19 @@
 }
 
 static int res_matches_filter(SyncDirectory *dir, char *res_path) {
-    
     UCX_FOREACH(inc, dir->include) {
         regex_t* pattern = (regex_t*) inc->data;
-        if (regexec(pattern, res_path, 0, NULL, 0)) {
-            return 1;
+        if (regexec(pattern, res_path, 0, NULL, 0) == 0) {
+            UCX_FOREACH(exc, dir->exclude) {
+                regex_t* pattern = (regex_t*) exc->data;
+                if (regexec(pattern, res_path, 0, NULL, 0) == 0) {
+                    return 1;
+                }
+            }
+            return 0;
         }
     }
-    
-    UCX_FOREACH(exc, dir->exclude) {
-        regex_t* pattern = (regex_t*) exc->data;
-        if (!regexec(pattern, res_path, 0, NULL, 0)) {
-            return 1;
-        }
-    }
-    
-    return 0;
+    return 1;
 }
 
 int cmd_pull(CmdArgs *a) {

mercurial