Fixed failing hunks.
authorWayne Davison <wayned@samba.org>
Tue, 30 Jan 2007 04:07:41 +0000 (04:07 +0000)
committerWayne Davison <wayned@samba.org>
Tue, 30 Jan 2007 04:07:41 +0000 (04:07 +0000)
detect-renamed.diff

index 749565d..2a37742 100644 (file)
@@ -97,7 +97,7 @@ TODO:
  static void send_directory(int f, struct file_list *flist, int ndx,
                           char *fbuf, int len, int flags);
  
-@@ -1706,6 +1748,25 @@ struct file_list *recv_file_list(int f)
+@@ -1711,6 +1753,25 @@ struct file_list *recv_file_list(int f)
  
        clean_flist(flist, relative_paths, 1);
  
@@ -141,7 +141,7 @@ TODO:
  
  int ignore_perishable = 0;
  int non_perishable_cnt = 0;
-@@ -102,12 +104,14 @@ int maybe_ATTRS_REPORT = 0;
+@@ -102,6 +104,7 @@ int maybe_ATTRS_REPORT = 0;
  
  static dev_t dev_zero;
  static int deletion_count = 0; /* used to implement --max-delete */
@@ -149,7 +149,9 @@ TODO:
  static int deldelay_size = 0, deldelay_cnt = 0;
  static char *deldelay_buf = NULL;
  static int deldelay_fd = -1;
- static BOOL solo_file = 0;
+@@ -110,7 +113,8 @@ static int dir_tweaking;
+ static int need_retouch_dir_times;
+ static const char *solo_file = NULL;
  
 -/* For calling delete_item() and delete_dir_contents(). */
 +/* For calling delete_item(), delete_dir_contents(), and delete_in_dir(). */
@@ -157,7 +159,7 @@ TODO:
  #define DEL_RECURSE           (1<<1) /* recurse */
  #define DEL_DIR_IS_EMPTY      (1<<2) /* internal delete_FUNCTIONS use only */
  
-@@ -129,11 +133,120 @@ static int is_backup_file(char *fn)
+@@ -132,11 +136,120 @@ static int is_backup_file(char *fn)
        return k > 0 && strcmp(fn+k, backup_suffix) == 0;
  }
  
@@ -278,7 +280,7 @@ TODO:
   */
  static enum delret delete_item(char *fbuf, int mode, char *replace, int flags)
  {
-@@ -155,6 +268,8 @@ static enum delret delete_item(char *fbu
+@@ -158,6 +271,8 @@ static enum delret delete_item(char *fbu
                        goto check_ret;
                /* OK: try to delete the directory. */
        }
@@ -287,7 +289,7 @@ TODO:
  
        if (!replace && max_delete >= 0 && ++deletion_count > max_delete)
                return DR_AT_LIMIT;
-@@ -201,6 +316,8 @@ static enum delret delete_item(char *fbu
+@@ -204,6 +319,8 @@ static enum delret delete_item(char *fbu
   * its contents, otherwise just checks for content.  Returns DR_SUCCESS or
   * DR_NOT_EMPTY.  Note that fname must point to a MAXPATHLEN buffer!  (The
   * buffer is used for recursion, but returned unchanged.)
@@ -296,7 +298,7 @@ TODO:
   */
  static enum delret delete_dir_contents(char *fname, int flags)
  {
-@@ -220,7 +337,9 @@ static enum delret delete_dir_contents(c
+@@ -223,7 +340,9 @@ static enum delret delete_dir_contents(c
        save_filters = push_local_filters(fname, dlen);
  
        non_perishable_cnt = 0;
@@ -306,7 +308,7 @@ TODO:
        ret = non_perishable_cnt ? DR_NOT_EMPTY : DR_SUCCESS;
  
        if (!dirlist->count)
-@@ -257,6 +376,8 @@ static enum delret delete_dir_contents(c
+@@ -260,6 +379,8 @@ static enum delret delete_dir_contents(c
                if (S_ISDIR(fp->mode)
                 && delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
                        ret = DR_NOT_EMPTY;
@@ -315,7 +317,7 @@ TODO:
                if (delete_item(fname, fp->mode, NULL, flags) != DR_SUCCESS)
                        ret = DR_NOT_EMPTY;
        }
-@@ -409,13 +530,17 @@ static void do_delayed_deletions(char *d
+@@ -412,13 +533,17 @@ static void do_delayed_deletions(char *d
   * all the --delete-WHEN options.  Note that the fbuf pointer must point to a
   * MAXPATHLEN buffer with the name of the directory in it (the functions we
   * call will append names onto the end, but the old dir value will be restored
@@ -336,7 +338,7 @@ TODO:
        int dlen, i;
  
        if (!flist) {
-@@ -426,21 +551,28 @@ static void delete_in_dir(struct file_li
+@@ -429,21 +554,28 @@ static void delete_in_dir(struct file_li
        if (verbose > 2)
                rprintf(FINFO, "delete_in_dir(%s)\n", fbuf);
  
@@ -370,7 +372,7 @@ TODO:
        if (one_file_system) {
                if (file->flags & FLAG_TOP_DIR)
                        filesystem_dev = *fs_dev;
-@@ -450,6 +582,11 @@ static void delete_in_dir(struct file_li
+@@ -453,6 +585,11 @@ static void delete_in_dir(struct file_li
  
        dirlist = get_dirlist(fbuf, dlen, 0);
  
@@ -382,7 +384,7 @@ TODO:
        /* If an item in dirlist is not found in flist, delete it
         * from the filesystem. */
        for (i = dirlist->count; i--; ) {
-@@ -462,16 +599,23 @@ static void delete_in_dir(struct file_li
+@@ -465,16 +602,23 @@ static void delete_in_dir(struct file_li
                                        f_name(fp, NULL));
                        continue;
                }
@@ -409,7 +411,7 @@ TODO:
        flist_free(dirlist);
  }
  
-@@ -501,9 +645,9 @@ static void do_delete_pass(struct file_l
+@@ -504,9 +648,9 @@ static void do_delete_pass(struct file_l
                 || !S_ISDIR(st.st_mode))
                        continue;
  
@@ -421,7 +423,7 @@ TODO:
  
        if (do_progress && !am_server)
                rprintf(FINFO, "                    \r");
-@@ -1038,6 +1182,7 @@ static int try_dests_non(struct file_str
+@@ -1023,6 +1167,7 @@ static int try_dests_non(struct file_str
        return j;
  }
  
@@ -429,7 +431,7 @@ TODO:
  static int phase = 0;
  
  /* Acts on cur_flist->file's ndx'th item, whose name is fname.  If a dir,
-@@ -1229,8 +1374,12 @@ static void recv_generator(char *fname, 
+@@ -1214,8 +1359,12 @@ static void recv_generator(char *fname, 
                        }
                }
                else if (delete_during && f_out != -1 && !phase && dry_run < 2
@@ -444,7 +446,7 @@ TODO:
                return;
        }
  
-@@ -1494,8 +1643,14 @@ static void recv_generator(char *fname, 
+@@ -1479,8 +1628,14 @@ static void recv_generator(char *fname, 
                if (preserve_hard_links && F_HLINK_NOT_LAST(file))
                        return;
  #endif
@@ -460,7 +462,7 @@ TODO:
                rsyserr(FERROR, stat_errno, "recv_generator: failed to stat %s",
                        full_fname(fname));
                return;
-@@ -1717,6 +1872,12 @@ void generate_files(int f_out, char *loc
+@@ -1775,6 +1930,12 @@ void generate_files(int f_out, const cha
        if (verbose > 2)
                rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid());
  
@@ -470,10 +472,10 @@ TODO:
 +                      delete_during = -1;
 +      }
 +
-       if (delete_before && !local_name && cur_flist->count > 0)
+       if (delete_before && !solo_file && cur_flist->count > 0)
                do_delete_pass(cur_flist);
        if (delete_during == 2) {
-@@ -1727,7 +1888,7 @@ void generate_files(int f_out, char *loc
+@@ -1785,7 +1946,7 @@ void generate_files(int f_out, const cha
        }
        do_progress = 0;
  
@@ -482,7 +484,7 @@ TODO:
                whole_file = 0;
        if (verbose >= 2) {
                rprintf(FINFO, "delta-transmission %s\n",
-@@ -1752,7 +1913,7 @@ void generate_files(int f_out, char *loc
+@@ -1810,7 +1971,7 @@ void generate_files(int f_out, const cha
                                        dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
                                } else
                                        dirdev = MAKEDEV(0, 0);
@@ -491,29 +493,29 @@ TODO:
                        }
                }
                for (i = cur_flist->low; i <= cur_flist->high; i++) {
-@@ -1798,7 +1959,21 @@ void generate_files(int f_out, char *loc
-               if (!inc_recurse) {
-                       if (delete_during)
--                              delete_in_dir(NULL, NULL, NULL, &dev_zero);
-+                              delete_in_dir(NULL, NULL, NULL, &dev_zero, 0);
-+                      if (detect_renamed) {
-+                              if (delete_during < 0)
-+                                      delete_during = 0;
-+                              detect_renamed = 0;
+@@ -1863,7 +2024,21 @@ void generate_files(int f_out, const cha
+       } while ((cur_flist = cur_flist->next) != NULL);
+       if (delete_during)
+-              delete_in_dir(NULL, NULL, NULL, &dev_zero);
++              delete_in_dir(NULL, NULL, NULL, &dev_zero, 0);
++      if (detect_renamed) {
++              if (delete_during < 0)
++                      delete_during = 0;
++              detect_renamed = 0;
 +
-+                              for (i = -1; (i = bitbag_next_bit(delayed_bits, i)) >= 0; ) {
-+                                      struct file_struct *file = flist->files[i];
-+                                      if (local_name)
-+                                              strlcpy(fbuf, local_name, sizeof fbuf);
-+                                      else
-+                                              f_name(file, fbuf);
-+                                      recv_generator(fbuf, file, i, itemizing, code, f_out);
-+                              }
-+                      }
-                       phase++;
-                       if (verbose > 2) {
-                               rprintf(FINFO, "generate_files phase=%d\n",
++              for (i = -1; (i = bitbag_next_bit(delayed_bits, i)) >= 0; ) {
++                      struct file_struct *file = flist->files[i];
++                      if (local_name)
++                              strlcpy(fbuf, local_name, sizeof fbuf);
++                      else
++                              f_name(file, fbuf);
++                      recv_generator(fbuf, file, i, itemizing, code, f_out);
++              }
++      }
+       phase++;
+       if (verbose > 2)
+               rprintf(FINFO, "generate_files phase=%d\n", phase);
 --- old/options.c
 +++ new/options.c
 @@ -78,6 +78,7 @@ int am_generator = 0;