Making backup-dir-dels depend on backup-deleted.
[rsync-patches.git] / backup-dir-dels.diff
index d8511029db59385926617fabd74cda80d8bdff7d..3ee80a55d33b53d39533783def2da6a7eda9ce8a 100644 (file)
@@ -15,11 +15,12 @@ Marc St-Onge
 
 To use this patch, run these commands for a successful build:
 
+    patch -p1 <patches/backup-deleted.diff
     patch -p1 <patches/backup-dir-dels.diff
     ./configure                                 (optional if already run)
     make
 
-based-on: 28b519c93b6db30b6520d46f8cd65160213fddd2
+based-on: patch/master/backup-deleted
 diff --git a/backup.c b/backup.c
 --- a/backup.c
 +++ b/backup.c
@@ -222,8 +223,8 @@ diff --git a/options.c b/options.c
  char *sockopts = NULL;
  char *usermap = NULL;
  char *groupmap = NULL;
-@@ -676,6 +682,8 @@ void usage(enum logcode F)
-   rprintf(F," -b, --backup                make backups (see --suffix & --backup-dir)\n");
+@@ -677,6 +683,8 @@ void usage(enum logcode F)
+   rprintf(F,"     --backup-deleted        make backups only of deleted files\n");
    rprintf(F,"     --backup-dir=DIR        make backups into hierarchy based in DIR\n");
    rprintf(F,"     --suffix=SUFFIX         set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
 +  rprintf(F,"     --backup-dir-dels=DIR   backup removed files into hierarchy based in DIR\n");
@@ -231,8 +232,8 @@ diff --git a/options.c b/options.c
    rprintf(F," -u, --update                skip files that are newer on the receiver\n");
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
    rprintf(F,"     --append                append data onto shorter files\n");
-@@ -985,7 +993,9 @@ static struct poptOption long_options[] = {
-   {"backup",          'b', POPT_ARG_VAL,    &make_backups, 1, 0, 0 },
+@@ -987,7 +995,9 @@ static struct poptOption long_options[] = {
+   {"backup-deleted",   0,  POPT_ARG_VAL,    &make_backups, 1, 0, 0 },
    {"no-backup",        0,  POPT_ARG_VAL,    &make_backups, 0, 0, 0 },
    {"backup-dir",       0,  POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
 +  {"backup-dir-dels",  0,  POPT_ARG_STRING, &backup_dir_dels, 0, 0, 0 },
@@ -241,7 +242,7 @@ diff --git a/options.c b/options.c
    {"list-only",        0,  POPT_ARG_VAL,    &list_only, 2, 0, 0 },
    {"read-batch",       0,  POPT_ARG_STRING, &batch_name, OPT_READ_BATCH, 0, 0 },
    {"write-batch",      0,  POPT_ARG_STRING, &batch_name, OPT_WRITE_BATCH, 0, 0 },
-@@ -2022,6 +2032,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2024,6 +2034,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, SP_DEFAULT);
                if (backup_dir)
                        backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT);
@@ -250,7 +251,7 @@ diff --git a/options.c b/options.c
        }
        if (daemon_filter_list.head && !am_sender) {
                filter_rule_list *elp = &daemon_filter_list;
-@@ -2043,6 +2055,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2045,6 +2057,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        if (check_filter(elp, FLOG, dir, 1) < 0)
                                goto options_rejected;
                }
@@ -265,7 +266,7 @@ diff --git a/options.c b/options.c
        }
  
        if (!backup_suffix)
-@@ -2054,6 +2074,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2056,6 +2076,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        backup_suffix);
                return 0;
        }
@@ -286,7 +287,7 @@ diff --git a/options.c b/options.c
        if (backup_dir) {
                size_t len;
                while (*backup_dir == '.' && backup_dir[1] == '/')
-@@ -2089,6 +2123,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2091,6 +2125,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        "P *%s", backup_suffix);
                parse_filter_str(&filter_list, backup_dir_buf, rule_template(0), 0);
        }
@@ -321,7 +322,7 @@ diff --git a/options.c b/options.c
  
        if (preserve_times) {
                preserve_times = PRESERVE_FILE_TIMES;
-@@ -2510,6 +2572,10 @@ void server_options(char **args, int *argc_p)
+@@ -2512,6 +2574,10 @@ void server_options(char **args, int *argc_p)
                args[ac++] = "--backup-dir";
                args[ac++] = backup_dir;
        }
@@ -332,7 +333,7 @@ diff --git a/options.c b/options.c
  
        /* Only send --suffix if it specifies a non-default value. */
        if (strcmp(backup_suffix, backup_dir ? "" : BACKUP_SUFFIX) != 0) {
-@@ -2518,7 +2584,14 @@ void server_options(char **args, int *argc_p)
+@@ -2520,7 +2586,14 @@ void server_options(char **args, int *argc_p)
                        goto oom;
                args[ac++] = arg;
        }
@@ -346,5 +347,5 @@ diff --git a/options.c b/options.c
 +              args[ac++] = arg;
 +      }
        if (am_sender) {
-               if (max_delete > 0) {
-                       if (asprintf(&arg, "--max-delete=%d", max_delete) < 0)
+               /* A remote sender just needs the above -b option.
+                * A remote receiver will override that with this option. */