Updated to apply cleanly.
[rsync/rsync-patches.git] / fuzzy.diff
index 3568814..34020a9 100644 (file)
@@ -13,7 +13,7 @@ test suite, but otherwise UNTESTED.]
   Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
 
 --- Makefile.in        15 May 2004 00:48:11 -0000      1.101
-+++ Makefile.in        21 May 2004 09:51:19 -0000
++++ Makefile.in        18 Jun 2004 17:32:53 -0000
 @@ -32,7 +32,7 @@ ZLIBOBJ=zlib/deflate.o zlib/infblock.o z
        zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
        zlib/zutil.o zlib/adler32.o
@@ -23,17 +23,17 @@ test suite, but otherwise UNTESTED.]
  OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \
        fileio.o batch.o clientname.o
  OBJS3=progress.o pipe.o
---- generator.c        18 May 2004 08:50:17 -0000      1.85
-+++ generator.c        21 May 2004 09:51:19 -0000
-@@ -51,6 +51,7 @@ extern int list_only;
- extern int only_existing;
- extern int orig_umask;
- extern int safe_symlinks;
+--- generator.c        18 Jun 2004 16:30:24 -0000      1.88
++++ generator.c        18 Jun 2004 17:32:53 -0000
+@@ -41,6 +41,7 @@ extern int ignore_times;
+ extern int size_only;
+ extern int io_timeout;
+ extern int protocol_version;
 +extern int fuzzy;
- extern struct exclude_list_struct server_exclude_list;
-@@ -258,7 +259,61 @@ static void generate_and_send_sums(struc
+ extern int always_checksum;
+ extern char *compare_dest;
+ extern int link_dest;
+@@ -259,7 +260,61 @@ static void generate_and_send_sums(struc
        }
  }
  
@@ -42,7 +42,7 @@ test suite, but otherwise UNTESTED.]
 +                        STRUCT_STAT *st)
 +{
 +      int fd = -1;
-+
 +      if (statret == 0) {
 +              if (S_ISREG(st->st_mode)) {
 +                      if (update_only
@@ -89,13 +89,13 @@ test suite, but otherwise UNTESTED.]
 +                      rsyserr(FERROR, errno, "fstat %s", full_fname(fname));
 +              }
 +      }
++
 +      return fd;
 +}
  
  /**
   * Acts on file number @p i from @p flist, whose name is @p fname.
-@@ -274,8 +329,6 @@ void recv_generator(char *fname, struct 
+@@ -275,8 +330,6 @@ void recv_generator(char *fname, struct 
        STRUCT_STAT st;
        struct map_struct *mapbuf;
        int statret;
@@ -104,7 +104,7 @@ test suite, but otherwise UNTESTED.]
  
        if (list_only)
                return;
-@@ -413,107 +466,39 @@ void recv_generator(char *fname, struct 
+@@ -416,109 +469,39 @@ void recv_generator(char *fname, struct 
        }
  #endif
  
@@ -122,7 +122,7 @@ test suite, but otherwise UNTESTED.]
 -              /* try the file at compare_dest instead */
 -              int saveerrno = errno;
 -              pathjoin(fnamecmpbuf, sizeof fnamecmpbuf, compare_dest, fname);
--              statret = link_stat(fnamecmpbuf,&st);
+-              statret = link_stat(fnamecmpbuf, &st, 0);
 -              if (!S_ISREG(st.st_mode))
 -                      statret = -1;
 -              if (statret == -1)
@@ -147,7 +147,8 @@ test suite, but otherwise UNTESTED.]
 -                      return;
 -              if (errno == ENOENT) {
 -                      write_int(f_out,i);
--                      if (!dry_run) write_sum_head(f_out, NULL);
+-                      if (!dry_run)
+-                              write_sum_head(f_out, NULL);
 -              } else if (verbose > 1) {
 +      /* Failed to stat for some reason besides "not found". */
 +      if (statret == -1 && errno != ENOENT) {
@@ -164,12 +165,23 @@ test suite, but otherwise UNTESTED.]
 -              if (delete_file(fname) != 0) {
 -                      return;
 -              }
--
++      if ((fd = open_base_file(file, fname, statret, &st)) == -2)
++              return;
 -              /* now pretend the file didn't exist */
--              if (preserve_hard_links && hard_link_check(file, HL_SKIP))
--                      return;
++      if ((disable_deltas_p() || dry_run) && fd != -1) {
++              close(fd);
++              fd = -1;
++      }
++
++      if (fd == -1) {
++              /* the file didn't exist, or we can pretend it doesn't */
+               if (preserve_hard_links && hard_link_check(file, HL_SKIP))
+                       return;
 -              write_int(f_out,i);
--              if (!dry_run) write_sum_head(f_out, NULL);
++              write_int(f_out, i);
+               if (!dry_run)
+                       write_sum_head(f_out, NULL);
 -              return;
 -      }
 -
@@ -178,7 +190,9 @@ test suite, but otherwise UNTESTED.]
 -                      rprintf(FINFO,"%s exists\n",fname);
 -              return;
 -      }
--
++              return;
++      }
 -      if (update_only && cmp_modtime(st.st_mtime,file->modtime)>0 && fnamecmp == fname) {
 -              if (verbose > 1)
 -                      rprintf(FINFO,"%s is newer\n",fname);
@@ -193,46 +207,33 @@ test suite, but otherwise UNTESTED.]
 -
 -      if (dry_run) {
 -              write_int(f_out,i);
-+      if ((fd = open_base_file(file, fname, statret, &st)) == -2)
-               return;
+-              return;
 -      }
+-
 -      if (disable_deltas_p()) {
 -              write_int(f_out,i);
 -              write_sum_head(f_out, NULL);
--              return;
-+      if ((disable_deltas_p() || dry_run) && fd != -1) {
-+              close(fd);
-+              fd = -1;
-       }
++      if (preserve_hard_links && hard_link_check(file, HL_CHECK_MASTER))
+               return;
+-      }
  
 -      /* open the file */
 -      fd = do_open(fnamecmp, O_RDONLY, 0);
 -
-       if (fd == -1) {
+-      if (fd == -1) {
 -              rsyserr(FERROR, errno, "failed to open %s, continuing",
 -                      full_fname(fnamecmp));
 -              /* pretend the file didn't exist */
-+              /* the file didn't exist, or we can pretend it doesn't */
-               if (preserve_hard_links && hard_link_check(file, HL_SKIP))
-                       return;
+-              if (preserve_hard_links && hard_link_check(file, HL_SKIP))
+-                      return;
 -              write_int(f_out,i);
 -              write_sum_head(f_out, NULL);
-+              write_int(f_out, i);
-+              if (!dry_run)
-+                      write_sum_head(f_out, NULL);
-+              return;
-+      }
-+
-+      if (preserve_hard_links && hard_link_check(file, HL_CHECK_MASTER))
-+              return;
-+
 +      if (!S_ISREG(file->mode)) {
 +              rprintf(FINFO, "skipping non-regular file \"%s\"\n",fname);
                return;
        }
  
-@@ -523,7 +508,7 @@ void recv_generator(char *fname, struct 
+@@ -528,7 +511,7 @@ void recv_generator(char *fname, struct 
                mapbuf = NULL;
  
        if (verbose > 3) {
@@ -241,9 +242,9 @@ test suite, but otherwise UNTESTED.]
                        (double)st.st_size);
        }
  
---- options.c  21 May 2004 09:44:32 -0000      1.150
-+++ options.c  21 May 2004 09:51:20 -0000
-@@ -91,6 +91,7 @@ int ignore_errors = 0;
+--- options.c  7 Jun 2004 22:05:22 -0000       1.156
++++ options.c  18 Jun 2004 17:32:54 -0000
+@@ -94,6 +94,7 @@ int ignore_errors = 0;
  int modify_window = 0;
  int blocking_io = -1;
  int checksum_seed = 0;
@@ -251,7 +252,7 @@ test suite, but otherwise UNTESTED.]
  unsigned int block_size = 0;
  
  
-@@ -266,6 +267,7 @@ void usage(enum logcode F)
+@@ -270,6 +271,7 @@ void usage(enum logcode F)
    rprintf(F," -T  --temp-dir=DIR          create temporary files in directory DIR\n");
    rprintf(F,"     --compare-dest=DIR      also compare destination files relative to DIR\n");
    rprintf(F,"     --link-dest=DIR         create hardlinks to DIR for unchanged files\n");
@@ -259,7 +260,7 @@ test suite, but otherwise UNTESTED.]
    rprintf(F," -P                          equivalent to --partial --progress\n");
    rprintf(F," -z, --compress              compress file data\n");
    rprintf(F," -C, --cvs-exclude           auto ignore files in the same way CVS does\n");
-@@ -363,6 +365,7 @@ static struct poptOption long_options[] 
+@@ -368,6 +370,7 @@ static struct poptOption long_options[] 
    {"temp-dir",        'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
    {"compare-dest",     0,  POPT_ARG_STRING, &compare_dest, 0, 0, 0 },
    {"link-dest",        0,  POPT_ARG_STRING, &compare_dest,  OPT_LINK_DEST, 0, 0 },
@@ -267,7 +268,7 @@ test suite, but otherwise UNTESTED.]
    /* TODO: Should this take an optional int giving the compression level? */
    {"compress",        'z', POPT_ARG_NONE,   &do_compression, 0, 0, 0 },
    {"daemon",           0,  POPT_ARG_NONE,   &daemon_opt, 0, 0, 0 },
-@@ -972,6 +975,9 @@ void server_options(char **args,int *arg
+@@ -989,6 +992,9 @@ void server_options(char **args,int *arg
                }
        }
  
@@ -277,9 +278,9 @@ test suite, but otherwise UNTESTED.]
        *argc = ac;
        return;
  
---- receiver.c 21 May 2004 08:27:04 -0000      1.79
-+++ receiver.c 21 May 2004 09:51:20 -0000
-@@ -47,6 +47,7 @@ extern int ignore_errors;
+--- receiver.c 14 Jun 2004 15:09:36 -0000      1.82
++++ receiver.c 18 Jun 2004 17:32:54 -0000
+@@ -48,6 +48,7 @@ extern int ignore_errors;
  extern int orig_umask;
  extern int keep_partial;
  extern int checksum_seed;
@@ -287,16 +288,16 @@ test suite, but otherwise UNTESTED.]
  
  static void delete_one(char *fn, int is_dir)
  {
-@@ -295,8 +296,6 @@ int recv_files(int f_in,struct file_list
+@@ -300,8 +301,6 @@ int recv_files(int f_in,struct file_list
        char *fname, fbuf[MAXPATHLEN];
        char template[MAXPATHLEN];
        char fnametmp[MAXPATHLEN];
 -      char *fnamecmp;
 -      char fnamecmpbuf[MAXPATHLEN];
        struct map_struct *mapbuf;
-       int i;
        struct file_struct *file;
-@@ -359,35 +358,31 @@ int recv_files(int f_in,struct file_list
+       struct stats initial_stats;
+@@ -364,35 +363,31 @@ int recv_files(int f_in,struct file_list
                if (verbose > 2)
                        rprintf(FINFO,"recv_files(%s)\n",fname);
  
@@ -341,7 +342,7 @@ test suite, but otherwise UNTESTED.]
                        receive_data(f_in, NULL, -1, NULL, file->length);
                        close(fd1);
                        continue;
-@@ -408,8 +403,10 @@ int recv_files(int f_in,struct file_list
+@@ -413,8 +408,10 @@ int recv_files(int f_in,struct file_list
  
                if (fd1 != -1 && st.st_size > 0) {
                        mapbuf = map_file(fd1,st.st_size);
@@ -354,9 +355,9 @@ test suite, but otherwise UNTESTED.]
                } else
                        mapbuf = NULL;
  
---- rsync.yo   21 May 2004 09:44:32 -0000      1.170
-+++ rsync.yo   21 May 2004 09:51:21 -0000
-@@ -324,6 +324,7 @@ verb(
+--- rsync.yo   5 Jun 2004 16:16:30 -0000       1.171
++++ rsync.yo   18 Jun 2004 17:32:54 -0000
+@@ -325,6 +325,7 @@ verb(
   -T  --temp-dir=DIR          create temporary files in directory DIR
       --compare-dest=DIR      also compare received files relative to DIR
       --link-dest=DIR         create hardlinks to DIR for unchanged files