If the partial-dir value is relative, add a directory-exclude for it
[rsync/rsync.git] / options.c
index 9c97191..3cee4ba 100644 (file)
--- a/options.c
+++ b/options.c
@@ -833,10 +833,18 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                                 link_dest ? "--link-dest" : "--compare-dest");
                        return 0;
                }
-       } else if (partial_dir) {
-               if (strcmp(partial_dir, ".") == 0)
-                       partial_dir = NULL;
-               keep_partial = 1;
+       } else {
+               if (keep_partial && !partial_dir)
+                       partial_dir = getenv("RSYNC_PARTIAL_DIR");
+               if (partial_dir) {
+                       if (!*partial_dir || strcmp(partial_dir, ".") == 0)
+                               partial_dir = NULL;
+                       else if (*partial_dir != '/') {
+                               add_exclude(&exclude_list, partial_dir,
+                                           XFLG_DIRECTORY);
+                       }
+                       keep_partial = 1;
+               }
        }
 
        if (files_from) {