X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/c0c7984e7f6009b6ab18ad3da998a56a9c0f083d..e2e42a01ba5a2258edf1510280bb83864a0c8748:/detect-renamed.diff diff --git a/detect-renamed.diff b/detect-renamed.diff index 4a47233..161bafb 100644 --- a/detect-renamed.diff +++ b/detect-renamed.diff @@ -71,7 +71,7 @@ diff --git a/flist.c b/flist.c static char empty_sum[MAX_DIGEST_LEN]; static int flist_count_offset; /* for --delete --progress */ static int dir_count = 0; -@@ -298,6 +301,45 @@ static int is_excluded(const char *fname, int is_dir, int filter_level) +@@ -287,6 +290,45 @@ static int is_excluded(const char *fname, int is_dir, int filter_level) return 0; } @@ -117,7 +117,7 @@ diff --git a/flist.c b/flist.c static void send_directory(int f, struct file_list *flist, char *fbuf, int len, int flags); -@@ -2235,6 +2277,25 @@ struct file_list *recv_file_list(int f) +@@ -2281,6 +2323,25 @@ struct file_list *recv_file_list(int f) flist_sort_and_clean(flist, relative_paths); @@ -446,7 +446,7 @@ diff --git a/generator.c b/generator.c flist_free(dirlist); if (!save_uid_ndx) { -@@ -568,9 +716,9 @@ static void do_delete_pass(void) +@@ -571,9 +719,9 @@ static void do_delete_pass(void) || !S_ISDIR(st.st_mode)) continue; @@ -458,7 +458,7 @@ diff --git a/generator.c b/generator.c if (do_progress && !am_server) rprintf(FINFO, " \r"); -@@ -1210,6 +1358,7 @@ static void list_file_entry(struct file_struct *f) +@@ -1226,6 +1374,7 @@ static void list_file_entry(struct file_struct *f) } } @@ -466,22 +466,23 @@ diff --git a/generator.c b/generator.c static int phase = 0; static int dflt_perms; -@@ -1480,8 +1629,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, - } +@@ -1502,9 +1651,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } else if (delete_during && f_out != -1 && !phase -- && BITS_SETnUNSET(file->flags, FLAG_CONTENT_DIR, FLAG_MISSING_DIR)) -- delete_in_dir(fname, file, &real_sx.st.st_dev); -+ && BITS_SETnUNSET(file->flags, FLAG_CONTENT_DIR, FLAG_MISSING_DIR)) { -+ if (detect_renamed && real_ret != 0) -+ unexplored_dirs++; -+ delete_in_dir(fname, file, &real_sx.st.st_dev, -+ delete_during < 0 ? DEL_NO_DELETIONS : 0); -+ } + && !(file->flags & FLAG_MISSING_DIR)) { +- if (file->flags & FLAG_CONTENT_DIR) +- delete_in_dir(fname, file, &real_sx.st.st_dev); +- else ++ if (file->flags & FLAG_CONTENT_DIR) { ++ if (detect_renamed && real_ret != 0) ++ unexplored_dirs++; ++ delete_in_dir(fname, file, &real_sx.st.st_dev, ++ delete_during < 0 ? DEL_NO_DELETIONS : 0); ++ } else + change_local_filter_dir(fname, strlen(fname), F_DEPTH(file)); + } goto cleanup; - } - -@@ -1757,8 +1910,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, +@@ -1782,8 +1934,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, goto cleanup; } #endif @@ -497,7 +498,7 @@ diff --git a/generator.c b/generator.c rsyserr(FERROR_XFER, stat_errno, "recv_generator: failed to stat %s", full_fname(fname)); goto cleanup; -@@ -2135,6 +2294,12 @@ void generate_files(int f_out, const char *local_name) +@@ -2185,6 +2343,12 @@ void generate_files(int f_out, const char *local_name) if (verbose > 2) rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid()); @@ -510,7 +511,7 @@ diff --git a/generator.c b/generator.c if (delete_before && !solo_file && cur_flist->used > 0) do_delete_pass(); if (delete_during == 2) { -@@ -2145,7 +2310,7 @@ void generate_files(int f_out, const char *local_name) +@@ -2195,7 +2359,7 @@ void generate_files(int f_out, const char *local_name) } do_progress = 0; @@ -519,16 +520,16 @@ diff --git a/generator.c b/generator.c whole_file = 0; if (verbose >= 2) { rprintf(FINFO, "delta-transmission %s\n", -@@ -2183,7 +2348,7 @@ void generate_files(int f_out, const char *local_name) +@@ -2237,7 +2401,7 @@ void generate_files(int f_out, const char *local_name) dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)); } else dirdev = MAKEDEV(0, 0); -- delete_in_dir(f_name(fp, fbuf), fp, &dirdev); -+ delete_in_dir(f_name(fp, fbuf), fp, &dirdev, 0); - } +- delete_in_dir(fbuf, fp, &dirdev); ++ delete_in_dir(fbuf, fp, &dirdev, 0); + } else + change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp)); } - } -@@ -2226,7 +2391,21 @@ void generate_files(int f_out, const char *local_name) +@@ -2284,7 +2448,21 @@ void generate_files(int f_out, const char *local_name) } while ((cur_flist = cur_flist->next) != NULL); if (delete_during) @@ -595,7 +596,7 @@ diff --git a/options.c b/options.c delay_updates ? "delay-updates" : "partial-dir"); return 0; } -@@ -1945,6 +1949,8 @@ void server_options(char **args, int *argc_p) +@@ -1951,6 +1955,8 @@ void server_options(char **args, int *argc_p) args[ac++] = "--super"; if (size_only) args[ac++] = "--size-only"; @@ -615,7 +616,7 @@ diff --git a/rsync.yo b/rsync.yo --compare-dest=DIR also compare received files relative to DIR --copy-dest=DIR ... and include copies of unchanged files --link-dest=DIR hardlink to files in DIR when unchanged -@@ -1474,6 +1475,21 @@ Note that the use of the bf(--delete) option might get rid of any potential +@@ -1480,6 +1481,21 @@ Note that the use of the bf(--delete) option might get rid of any potential fuzzy-match files, so either use bf(--delete-after) or specify some filename exclusions if you need to prevent this. @@ -640,7 +641,7 @@ diff --git a/rsync.yo b/rsync.yo diff --git a/util.c b/util.c --- a/util.c +++ b/util.c -@@ -1112,6 +1112,32 @@ int handle_partial_dir(const char *fname, int create) +@@ -1125,6 +1125,32 @@ int handle_partial_dir(const char *fname, int create) return 1; }