]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Fix --whole-file problem that caused it to be the default even for
authorMartin Pool <mbp@samba.org>
Tue, 19 Mar 2002 03:21:53 +0000 (03:21 +0000)
committerMartin Pool <mbp@samba.org>
Tue, 19 Mar 2002 03:21:53 +0000 (03:21 +0000)
remote connections.  (Frank Schulz)

<http://lists.samba.org/pipermail/rsync/2002-March/006526.html>

Also, add documentation for whole_file and add assertions that the
value is valid.

NEWS
generator.c
options.c
rsync.h

diff --git a/NEWS b/NEWS
index e898557a1e2aa460835e04e0bd0e1e4e15210b1a..3a22226ca3d2ab9a5e69a522b15ce816c1467fe4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,3 +14,6 @@ rsync changes since last release
 
     * Fix minor memory leak in socket code.  (Dave Dykstra, Martin
       Pool.)
+
+    * Fix --whole-file problem that caused it to be the default even
+      for remote connections.  (Frank Schulz)
index 80f6f1354fc097524285f4a4f1f1362fb25f9860..950e315075578911b8f1cf6af6f2e785df0d8e6c 100644 (file)
@@ -403,6 +403,8 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
                return;
        }
 
+       assert(whole_file == 0 || whole_file == 1);
+       /* We should have decided by now.* /
        if (whole_file) {
                write_int(f_out,i);
                send_sums(NULL,f_out);    
index 38bc63ac6ace8a63f84d2340de8fdaca0a6691d2..0f2163430d19922d6b51e2231f7b42e26e7f5bb5 100644 (file)
--- a/options.c
+++ b/options.c
 #include "popt.h"
 
 int make_backups = 0;
+
+/**
+ * Should we send the whole file as literal data rather than trying to
+ * create an incremental diff?  This is on by default when both source
+ * and destination are local and we're not doing a batch delta,
+ * because there it's no cheaper to read the whole basis file than to
+ * just rewrite it.
+ *
+ * -1 means "unspecified", i.e. depend on is_local; 0 means off; 1 means on.
+ **/
 int whole_file = -1;
+
 int copy_links = 0;
 int preserve_links = 0;
 int preserve_hard_links = 0;
@@ -616,8 +627,13 @@ void server_options(char **args,int *argc)
                argstr[x++] = 'l';
        if (copy_links)
                argstr[x++] = 'L';
+
+       assert(whole_file == 0 || whole_file == -1);
        if (whole_file)
                argstr[x++] = 'W';
+       else 
+               args[ac++] = "--no-whole-file";
+       
        if (preserve_hard_links)
                argstr[x++] = 'H';
        if (preserve_uid)
@@ -758,7 +774,6 @@ void server_options(char **args,int *argc)
                args[ac++] = compare_dest;
        }
 
-
        *argc = ac;
 }
 
diff --git a/rsync.h b/rsync.h
index 449ce094cad03a9953c335691bd0a4e5a6f85c5c..6eacbcf5c717256bb02ac32406d961ed9f97ea58 100644 (file)
--- a/rsync.h
+++ b/rsync.h
@@ -217,6 +217,8 @@ enum logcode {FNONE=0, FERROR=1, FINFO=2, FLOG=3 };
 #include <compat.h>
 #endif
 
+#include <assert.h>
+
 
 #define BOOL int