Got rid of kluged value for am_sender, and instead added a new
[rsync/rsync.git] / generator.c
index 93a707a..b0913a0 100644 (file)
@@ -89,12 +89,14 @@ static int unchanged_attrs(struct file_struct *file, STRUCT_STAT *st)
 
 #define SID_UPDATING             ITEM_UPDATING
 #define SID_REPORT_CHECKSUM      ITEM_REPORT_CHECKSUM
+#define SID_USING_ALT_BASIS      ITEM_USING_ALT_BASIS
+/* This flag doesn't get sent, so it must be outside 0xffff. */
 #define SID_NO_DEST_AND_NO_UPDATE (1<<16)
 
 static void itemize(struct file_struct *file, int statret, STRUCT_STAT *st,
                    int32 sflags, int f_out, int ndx)
 {
-       int iflags = sflags & (SID_UPDATING | SID_REPORT_CHECKSUM);
+       int iflags = sflags & 0xffff;
 
        if (statret >= 0) {
                if (S_ISREG(file->mode) && file->length != st->st_size)
@@ -821,11 +823,12 @@ prepare_to_open:
 notify_others:
        write_int(f_out, ndx);
        if (itemizing) {
-               itemize(file, statret, &st, SID_UPDATING
-                       | (always_checksum ? SID_REPORT_CHECKSUM : 0),
-                       f_out, -1);
-               if (inplace && !read_batch)
-                       write_byte(f_out, fnamecmp_type);
+               int iflags = SID_UPDATING;
+               if (always_checksum)
+                       iflags |= SID_REPORT_CHECKSUM;
+               if (fnamecmp_type != FNAMECMP_FNAME)
+                       iflags |= SID_USING_ALT_BASIS;
+               itemize(file, statret, &st, iflags, f_out, -1);
        }
        if (f_out_name >= 0) {
                write_byte(f_out_name, fnamecmp_type);
@@ -841,7 +844,7 @@ notify_others:
 #endif
                        }
                        *lb = len;
-                       write_buf(f_out_name, lenbuf, lb - lenbuf + 1);
+                       write_buf(f_out_name, (char*)lenbuf, lb - lenbuf + 1);
                        write_buf(f_out_name, fuzzy_file->basename, len);
                }
        }
@@ -885,10 +888,10 @@ void generate_files(int f_out, struct file_list *flist, char *local_name,
        }
 
        if (verbose >= 2) {
-               rprintf(FINFO,
+               rprintf(FINFO, "delta-transmission %s\n",
                        whole_file > 0
-                       ? "delta-transmission disabled for local transfer or --whole-file\n"
-                       : "delta transmission enabled\n");
+                       ? "disabled for local transfer or --whole-file"
+                       : "enabled");
        }
 
        /* We expect to just sit around now, so don't exit on a timeout.