Updated to apply to latest generator.c.
authorWayne Davison <wayned@samba.org>
Wed, 2 Mar 2005 17:51:40 +0000 (17:51 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 2 Mar 2005 17:51:40 +0000 (17:51 +0000)
copy-dest.diff

index 49e07a192e36e51aef0d22d54e48853b55d7b577..091e29c78374e8f207a3c655c42cf8dfb9f88f2a 100644 (file)
@@ -2,7 +2,7 @@ This adds the option --copy-dest, which works just like --link-dest
 except that identical files are copied into the destination instead
 of hard-linked.
 
---- orig/generator.c   2005-03-02 17:28:17
+--- orig/generator.c   2005-03-02 17:48:47
 +++ generator.c        2005-03-02 17:30:18
 @@ -65,6 +65,7 @@ extern int always_checksum;
  extern char *partial_dir;
@@ -12,7 +12,7 @@ of hard-linked.
  extern int link_dest;
  extern int whole_file;
  extern int local_server;
-@@ -833,6 +834,8 @@ static void recv_generator(char *fname, 
+@@ -831,6 +832,8 @@ static void recv_generator(char *fname, 
                                        continue;
                                best_match = i;
                                match_level = 2;
@@ -21,15 +21,11 @@ of hard-linked.
                                /* FALL THROUGH */
                        case 2:
                                if (!unchanged_attrs(file, &st))
-@@ -862,10 +865,23 @@ static void recv_generator(char *fname, 
-                                               full_fname(fnamecmpbuf),
-                                               safe_fname(fname));
-                               }
--                              match_level = 1;
-+                              match_level = 2;
+@@ -863,7 +866,20 @@ static void recv_generator(char *fname, 
+                               match_level = 2;
                        }
  #endif
--                      if (match_level && match_level < 3) {
+-                      if (compare_dest || (match_level && match_level < 3)) {
 +                      if (match_level == 2) {
 +                              /* Copy the file locally. */
 +                              if (copy_file(fnamecmpbuf, fname, file->mode) < 0) {
@@ -43,7 +39,7 @@ of hard-linked.
 +                                      statret = -1;
 +                              } else
 +                                      set_perms(fname, file, NULL, 0);
-+                      } else if (match_level == 1) {
++                      } else if (compare_dest || match_level == 1) {
                                fnamecmp = fnamecmpbuf;
                                fnamecmp_type = i;
                        }