We now pass the --detect-renamed option to the server if we're not
authorWayne Davison <wayned@samba.org>
Sun, 5 Mar 2006 21:15:48 +0000 (21:15 +0000)
committerWayne Davison <wayned@samba.org>
Sun, 5 Mar 2006 21:15:48 +0000 (21:15 +0000)
the receiver.

detect-renamed.diff

index e531301..3fc619a 100644 (file)
@@ -34,7 +34,7 @@ TODO:
 
 --- old/flist.c
 +++ new/flist.c
-@@ -56,6 +56,7 @@ extern int implied_dirs;
+@@ -55,6 +55,7 @@ extern int implied_dirs;
  extern int prune_empty_dirs;
  extern int copy_links;
  extern int copy_unsafe_links;
@@ -42,7 +42,7 @@ TODO:
  extern int protocol_version;
  extern int sanitize_paths;
  extern const char *io_write_phase;
-@@ -74,6 +75,8 @@ int checksum_len;
+@@ -73,6 +74,8 @@ int checksum_len;
  dev_t filesystem_dev; /* used to implement -x */
  unsigned int file_struct_len;
  
@@ -51,7 +51,7 @@ TODO:
  static char empty_sum[MD4_SUM_LENGTH];
  static int flist_count_offset;
  
-@@ -260,6 +263,44 @@ static mode_t from_wire_mode(int mode)
+@@ -259,6 +262,44 @@ static mode_t from_wire_mode(int mode)
        return (mode_t)mode;
  }
  
@@ -96,7 +96,7 @@ TODO:
  static void send_directory(int f, struct file_list *flist,
                           char *fbuf, int len);
  
-@@ -1388,6 +1429,25 @@ struct file_list *recv_file_list(int f)
+@@ -1387,6 +1428,25 @@ struct file_list *recv_file_list(int f)
  
        clean_flist(flist, relative_paths, 1);
  
@@ -132,7 +132,7 @@ TODO:
  extern int whole_file;
  extern int list_only;
  extern int read_batch;
-@@ -92,14 +93,17 @@ extern char *backup_dir;
+@@ -91,14 +92,17 @@ extern char *backup_dir;
  extern char *backup_suffix;
  extern int backup_suffix_len;
  extern struct file_list *the_file_list;
@@ -151,7 +151,7 @@ TODO:
  #define DEL_TERSE             (1<<3)
  
  
-@@ -109,12 +113,120 @@ static int is_backup_file(char *fn)
+@@ -108,12 +112,120 @@ static int is_backup_file(char *fn)
        return k > 0 && strcmp(fn+k, backup_suffix) == 0;
  }
  
@@ -272,7 +272,7 @@ TODO:
   */
  static int delete_item(char *fname, int mode, int flags)
  {
-@@ -125,6 +237,8 @@ static int delete_item(char *fname, int 
+@@ -124,6 +236,8 @@ static int delete_item(char *fname, int 
        char *p;
  
        if (!S_ISDIR(mode)) {
@@ -281,7 +281,7 @@ TODO:
                if (max_delete && ++deletion_count > max_delete)
                        return 0;
                if (make_backups && (backup_dir || !is_backup_file(fname)))
-@@ -147,6 +261,7 @@ static int delete_item(char *fname, int 
+@@ -146,6 +260,7 @@ static int delete_item(char *fname, int 
  
        zap_dir = flags & DEL_FORCE_RECURSE || force_delete;
        if ((max_delete && ++deletion_count > max_delete)
@@ -289,7 +289,7 @@ TODO:
            || (dry_run && zap_dir)) {
                ok = 0;
                errno = ENOTEMPTY;
-@@ -189,6 +304,8 @@ static int delete_item(char *fname, int 
+@@ -188,6 +303,8 @@ static int delete_item(char *fname, int 
                        continue;
  
                strlcpy(p, fp->basename, remainder);
@@ -298,7 +298,7 @@ TODO:
                delete_item(fname, fp->mode, flags & ~DEL_TERSE);
        }
        flist_free(dirlist);
-@@ -197,7 +314,8 @@ static int delete_item(char *fname, int 
+@@ -196,7 +313,8 @@ static int delete_item(char *fname, int 
  
        pop_local_filters(save_filters);
  
@@ -308,7 +308,7 @@ TODO:
                return 0;
  
        if (do_rmdir(fname) == 0) {
-@@ -217,15 +335,19 @@ static int delete_item(char *fname, int 
+@@ -216,15 +334,19 @@ static int delete_item(char *fname, int 
   * all the --delete-WHEN options.  Note that the fbuf pointer must point to a
   * MAXPATHLEN buffer with the name of the directory in it (the functions we
   * call will append names onto the end, but the old dir value will be restored
@@ -331,7 +331,7 @@ TODO:
        int dlen, i;
  
        if (!flist) {
-@@ -239,6 +361,8 @@ static void delete_in_dir(struct file_li
+@@ -238,6 +360,8 @@ static void delete_in_dir(struct file_li
        if (verbose > 2)
                rprintf(FINFO, "delete_in_dir(%s)\n", fbuf);
  
@@ -340,7 +340,7 @@ TODO:
        if (allowed_lull)
                maybe_send_keepalive();
  
-@@ -246,12 +370,14 @@ static void delete_in_dir(struct file_li
+@@ -245,12 +369,14 @@ static void delete_in_dir(struct file_li
                return; /* Impossible... */
  
        if (io_error && !(lp_ignore_errors(module_id) || ignore_errors)) {
@@ -360,7 +360,7 @@ TODO:
        }
  
        while (cur_depth >= file->dir.depth && cur_depth >= min_depth)
-@@ -262,6 +388,9 @@ static void delete_in_dir(struct file_li
+@@ -261,6 +387,9 @@ static void delete_in_dir(struct file_li
        dlen = strlen(fbuf);
        filt_array[cur_depth] = push_local_filters(fbuf, dlen);
  
@@ -370,7 +370,7 @@ TODO:
        if (one_file_system) {
                if (file->flags & FLAG_TOP_DIR)
                        filesystem_dev = stp->st_dev;
-@@ -271,18 +400,30 @@ static void delete_in_dir(struct file_li
+@@ -270,18 +399,30 @@ static void delete_in_dir(struct file_li
  
        dirlist = get_dirlist(fbuf, dlen, 0);
  
@@ -403,7 +403,7 @@ TODO:
        flist_free(dirlist);
  }
  
-@@ -312,9 +453,9 @@ static void do_delete_pass(struct file_l
+@@ -311,9 +452,9 @@ static void do_delete_pass(struct file_l
                 || !S_ISDIR(st.st_mode))
                        continue;
  
@@ -415,7 +415,7 @@ TODO:
  
        if (do_progress && !am_server)
                rprintf(FINFO, "                    \r");
-@@ -753,6 +894,7 @@ static int try_dests_non(struct file_str
+@@ -752,6 +893,7 @@ static int try_dests_non(struct file_str
        return -1;
  }
  
@@ -423,7 +423,7 @@ TODO:
  static int phase = 0;
  
  /* Acts on the_file_list->file's ndx'th item, whose name is fname.  If a dir,
-@@ -894,8 +1036,12 @@ static void recv_generator(char *fname, 
+@@ -906,8 +1048,12 @@ static void recv_generator(char *fname, 
                    && verbose && code && f_out != -1)
                        rprintf(code, "%s/\n", fname);
                if (delete_during && f_out != -1 && !phase && dry_run < 2
@@ -438,7 +438,7 @@ TODO:
                return;
        }
  
-@@ -1133,8 +1279,14 @@ static void recv_generator(char *fname, 
+@@ -1145,8 +1291,14 @@ static void recv_generator(char *fname, 
                    && hard_link_check(file, ndx, fname, statret, &st,
                                       itemizing, code, HL_SKIP))
                        return;
@@ -454,7 +454,7 @@ TODO:
                rsyserr(FERROR, stat_errno, "recv_generator: failed to stat %s",
                        full_fname(fname));
                return;
-@@ -1309,11 +1461,17 @@ void generate_files(int f_out, struct fi
+@@ -1323,11 +1475,17 @@ void generate_files(int f_out, struct fi
                        (long)getpid(), flist->count);
        }
  
@@ -473,7 +473,7 @@ TODO:
                whole_file = 0;
        if (verbose >= 2) {
                rprintf(FINFO, "delta-transmission %s\n",
-@@ -1368,7 +1526,23 @@ void generate_files(int f_out, struct fi
+@@ -1382,7 +1540,23 @@ void generate_files(int f_out, struct fi
        }
        recv_generator(NULL, NULL, 0, 0, 0, code, -1);
        if (delete_during)
@@ -500,15 +500,15 @@ TODO:
        csum_length = SUM_LENGTH;
 --- old/options.c
 +++ new/options.c
-@@ -78,6 +78,7 @@ int am_starting_up = 1;
- int orig_umask = 0;
+@@ -78,6 +78,7 @@ int am_generator = 0;
+ int am_starting_up = 1;
  int relative_paths = -1;
  int implied_dirs = 1;
 +int detect_renamed = 0;
  int numeric_ids = 0;
  int allow_8bit_chars = 0;
  int force_delete = 0;
-@@ -335,6 +336,7 @@ void usage(enum logcode F)
+@@ -336,6 +337,7 @@ void usage(enum logcode F)
    rprintf(F,"     --modify-window=NUM     compare mod-times with reduced accuracy\n");
    rprintf(F," -T, --temp-dir=DIR          create temporary files in directory DIR\n");
    rprintf(F," -y, --fuzzy                 find similar file for basis if no dest file\n");
@@ -516,7 +516,7 @@ TODO:
    rprintf(F,"     --compare-dest=DIR      also compare destination files relative to DIR\n");
    rprintf(F,"     --copy-dest=DIR         ... and include copies of unchanged files\n");
    rprintf(F,"     --link-dest=DIR         hardlink to files in DIR when unchanged\n");
-@@ -480,6 +482,7 @@ static struct poptOption long_options[] 
+@@ -483,6 +485,7 @@ static struct poptOption long_options[] 
    {"compare-dest",     0,  POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
    {"copy-dest",        0,  POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
    {"link-dest",        0,  POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
@@ -524,7 +524,7 @@ TODO:
    {"fuzzy",           'y', POPT_ARG_NONE,   &fuzzy_basis, 0, 0, 0 },
    {"compress",        'z', POPT_ARG_NONE,   0, 'z', 0, 0 },
    {"compress-level",   0,  POPT_ARG_INT,    &def_compress_level, 'z', 0, 0 },
-@@ -1334,7 +1337,7 @@ int parse_arguments(int *argc, const cha
+@@ -1343,7 +1346,7 @@ int parse_arguments(int *argc, const cha
                inplace = 1;
        }
  
@@ -533,7 +533,7 @@ TODO:
                partial_dir = tmp_partialdir;
  
        if (inplace) {
-@@ -1343,6 +1346,7 @@ int parse_arguments(int *argc, const cha
+@@ -1352,6 +1355,7 @@ int parse_arguments(int *argc, const cha
                        snprintf(err_buf, sizeof err_buf,
                                 "--%s cannot be used with --%s\n",
                                 append_mode ? "append" : "inplace",
@@ -541,9 +541,18 @@ TODO:
                                 delay_updates ? "delay-updates" : "partial-dir");
                        return 0;
                }
+@@ -1654,6 +1658,8 @@ void server_options(char **args,int *arg
+                       args[ac++] = "--super";
+               if (size_only)
+                       args[ac++] = "--size-only";
++              if (detect_renamed)
++                      args[ac++] = "--detect-renamed";
+       }
+       if (modify_window_set) {
 --- old/rsync.yo
 +++ new/rsync.yo
-@@ -358,6 +358,7 @@ to the detailed description below for a 
+@@ -362,6 +362,7 @@ to the detailed description below for a 
       --modify-window=NUM     compare mod-times with reduced accuracy
   -T, --temp-dir=DIR          create temporary files in directory DIR
   -y, --fuzzy                 find similar file for basis if no dest file
@@ -551,7 +560,7 @@ TODO:
       --compare-dest=DIR      also compare received files relative to DIR
       --copy-dest=DIR         ... and include copies of unchanged files
       --link-dest=DIR         hardlink to files in DIR when unchanged
-@@ -1183,6 +1184,15 @@ Note that the use of the bf(--delete) op
+@@ -1240,6 +1241,15 @@ Note that the use of the bf(--delete) op
  fuzzy-match files, so either use bf(--delete-after) or specify some
  filename exclusions if you need to prevent this.
  
@@ -569,7 +578,7 @@ TODO:
  files against doing transfers (if the files are missing in the destination
 --- old/util.c
 +++ new/util.c
-@@ -997,6 +997,32 @@ int handle_partial_dir(const char *fname
+@@ -1013,6 +1013,32 @@ int handle_partial_dir(const char *fname
        return 1;
  }