Fixed a failing hunk.
[rsync/rsync-patches.git] / inplace-protocol-bump.diff
index 1366745..170d08b 100644 (file)
@@ -3,9 +3,9 @@ sender if --inplace was specified.  This allows the sender to know when
 the transfer can fully utilize the basis file (i.e., when the basis file
 is not the destination file).
 
---- orig/generator.c   2004-11-03 20:30:45
+--- orig/generator.c   2005-01-14 18:30:18
 +++ generator.c        2004-11-03 20:37:57
-@@ -563,6 +563,8 @@ prepare_to_open:
+@@ -593,6 +593,8 @@ prepare_to_open:
  
  notify_others:
        write_int(f_out, i);
@@ -14,61 +14,69 @@ is not the destination file).
        if (f_out_name >= 0)
                write_byte(f_out_name, fnamecmp_type);
  
---- orig/match.c       2004-09-07 21:45:30
-+++ match.c    2004-11-03 20:38:34
-@@ -24,7 +24,8 @@ extern int am_server;
+--- orig/match.c       2005-01-01 21:11:00
++++ match.c    2004-11-12 05:48:57
+@@ -23,8 +23,8 @@ extern int verbose;
+ extern int am_server;
  extern int do_progress;
  extern int checksum_seed;
- extern int inplace;
+-extern int inplace;
 -extern int make_backups;
 +
-+int alternate_basis;
++int updating_basis_file;
  
  typedef unsigned short tag;
  
-@@ -205,7 +206,7 @@ static void hash_search(int f,struct sum
+@@ -206,9 +206,9 @@ static void hash_search(int f,struct sum
+                       if (l != s->sums[i].len)
+                               continue;
  
-                       /* inplace: ensure chunk's offset is either >= our
+-                      /* inplace: ensure chunk's offset is either >= our
++                      /* in-place: ensure chunk's offset is either >= our
                         * offset or that the data didn't move. */
 -                      if (inplace && !make_backups && s->sums[i].offset < offset
-+                      if (inplace && !alternate_basis && s->sums[i].offset < offset
++                      if (updating_basis_file && s->sums[i].offset < offset
                            && !(s->sums[i].flags & SUMFLG_SAME_OFFSET))
                                continue;
  
-@@ -227,7 +228,7 @@ static void hash_search(int f,struct sum
-                       /* If inplace is enabled, the best possible match is
+@@ -227,10 +227,10 @@ static void hash_search(int f,struct sum
+                               continue;
+                       }
+-                      /* If inplace is enabled, the best possible match is
++                      /* When updating in-place, the best possible match is
                         * one with an identical offset, so we prefer that over
                         * the following want_i optimization. */
 -                      if (inplace && !make_backups) {
-+                      if (inplace && !alternate_basis) {
++                      if (updating_basis_file) {
                                do {
                                        size_t i2 = targets[j].i;
                                        if (s->sums[i2].offset != offset)
-@@ -250,7 +251,7 @@ static void hash_search(int f,struct sum
+@@ -253,7 +253,7 @@ static void hash_search(int f,struct sum
                        /* we've found a match, but now check to see
                         * if want_i can hint at a better match. */
                        if (i != want_i && want_i < s->count
 -                          && (!inplace || make_backups || s->sums[want_i].offset >= offset
-+                          && (!inplace || alternate_basis || s->sums[want_i].offset >= offset
++                          && (!updating_basis_file || s->sums[want_i].offset >= offset
                             || s->sums[want_i].flags & SUMFLG_SAME_OFFSET)
                            && sum == s->sums[want_i].sum1
                            && memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) {
---- orig/options.c     2004-10-14 17:11:40
-+++ options.c  2004-11-03 20:47:21
-@@ -884,10 +884,9 @@ int parse_arguments(int *argc, const cha
-                        am_server ? "server" : "client");
-               return 0;
- #endif
--              if (compare_dest) {
-+              if (link_dest) {
-                       snprintf(err_buf, sizeof err_buf,
--                               "--inplace does not yet work with %s\n",
--                               link_dest ? "--link-dest" : "--compare-dest");
-+                               "--inplace does not yet work with --link-dest\n");
+--- orig/options.c     2005-01-15 20:26:21
++++ options.c  2005-01-15 20:26:06
+@@ -952,12 +952,6 @@ int parse_arguments(int *argc, const cha
                        return 0;
                }
-       } else {
---- orig/rsync.h       2004-11-03 20:30:45
+               keep_partial = 0;
+-              if (dest_option) {
+-                      snprintf(err_buf, sizeof err_buf,
+-                               "--inplace does not yet work with %s\n",
+-                               dest_option);
+-                      return 0;
+-              }
+ #else
+               snprintf(err_buf, sizeof err_buf,
+                        "--inplace is not supported on this %s\n",
+--- orig/rsync.h       2005-01-10 00:21:12
 +++ rsync.h    2004-11-03 20:32:34
 @@ -62,7 +62,7 @@
  #define FLAG_MOUNT_POINT (1<<2)       /* sender only */
@@ -79,35 +87,27 @@ is not the destination file).
  
  /* We refuse to interoperate with versions that are not in this range.
   * Note that we assume we'll work with later versions: the onus is on
---- orig/sender.c      2004-09-20 05:10:48
-+++ sender.c   2004-11-03 20:38:50
+--- orig/sender.c      2005-01-01 21:11:01
++++ sender.c   2004-11-12 05:51:25
 @@ -27,7 +27,9 @@ extern int dry_run;
  extern int am_server;
  extern int am_daemon;
  extern int protocol_version;
-+extern int alternate_basis;
++extern int updating_basis_file;
  extern int make_backups;
 +extern int inplace;
  extern struct stats stats;
  
  
-@@ -117,6 +119,7 @@ void send_files(struct file_list *flist,
-       struct map_struct *mbuf = NULL;
-       STRUCT_STAT st;
-       char *fname2, fname[MAXPATHLEN];
-+      uchar fnamecmp_type = FNAMECMP_FNAME;
-       int i;
-       struct file_struct *file;
-       int phase = 0;
-@@ -166,6 +169,11 @@ void send_files(struct file_list *flist,
+@@ -166,6 +168,11 @@ void send_files(struct file_list *flist,
                } else
                        offset = 0;
                fname2 = f_name_to(file, fname + offset);
-+              if (protocol_version >= 29 && inplace) {
-+                      fnamecmp_type = read_byte(f_in);
-+                      alternate_basis = fnamecmp_type != FNAMECMP_FNAME;
++              if (inplace && protocol_version >= 29) {
++                      uchar fnamecmp_type = read_byte(f_in);
++                      updating_basis_file = fnamecmp_type == FNAMECMP_FNAME;
 +              } else
-+                      alternate_basis = make_backups;
++                      updating_basis_file = inplace && !make_backups;
  
                if (verbose > 2)
                        rprintf(FINFO, "send_files(%d, %s)\n", i, fname);