-- Matt McCutchen <hashproduct+rsync@gmail.com>
---- old/generator.c
-+++ new/generator.c
-@@ -188,7 +188,9 @@ static int fattr_find(struct file_struct
+based-on: patch/master/detect-renamed
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
+@@ -468,7 +468,9 @@ static int fattr_find(struct file_struct *f, char *fname)
continue;
}
}
diff = u_strcmp(fmid->basename, f->basename);
if (diff == 0) {
good_match = mid;
-@@ -1826,6 +1828,21 @@ static void recv_generator(char *fname,
+@@ -1783,6 +1785,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
}
if (!do_xfers)
---- old/options.c
-+++ new/options.c
-@@ -385,6 +385,8 @@ void usage(enum logcode F)
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -745,6 +745,8 @@ void usage(enum logcode F)
rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n");
rprintf(F," --detect-renamed try to find renamed files to speed up the transfer\n");
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n");
rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n");
-@@ -563,7 +565,9 @@ static struct poptOption long_options[]
+@@ -940,7 +942,9 @@ static struct poptOption long_options[] = {
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
{"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
+ {"detect-renamed", 0, POPT_ARG_VAL, &detect_renamed, 1, 0, 0 },
+ {"detect-renamed-lax",0, POPT_ARG_VAL, &detect_renamed, 2, 0, 0 },
+ {"detect-moved", 0, POPT_ARG_VAL, &detect_renamed, 3, 0, 0 },
- {"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 },
- {"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 },
- {"no-compress", 0, POPT_ARG_VAL, &do_compression, 0, 0, 0 },
-@@ -1895,8 +1899,14 @@ void server_options(char **args, int *ar
- }
- }
- /* Both sides need to know in case this disables incremental recursion. */
-- if (detect_renamed)
-- args[ac++] = "--detect-renamed";
-+ if (detect_renamed) {
-+ if (detect_renamed == 1)
-+ args[ac++] = "--detect-renamed";
-+ else if (detect_renamed == 2)
-+ args[ac++] = "--detect-renamed-lax";
-+ else
-+ args[ac++] = "--detect-moved";
-+ }
-
- if (modify_window_set) {
- if (asprintf(&arg, "--modify-window=%d", modify_window) < 0)
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -385,6 +385,8 @@ to the detailed description below for a
+ {"fuzzy", 'y', POPT_ARG_VAL, &fuzzy_basis, 1, 0, 0 },
+ {"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
+ {"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
+@@ -2532,8 +2536,14 @@ void server_options(char **args, int *argc_p)
+ args[ac++] = "--super";
+ if (size_only)
+ args[ac++] = "--size-only";
+- if (detect_renamed)
+- args[ac++] = "--detect-renamed";
++ if (detect_renamed) {
++ if (detect_renamed == 1)
++ args[ac++] = "--detect-renamed";
++ else if (detect_renamed == 2)
++ args[ac++] = "--detect-renamed-lax";
++ else
++ args[ac++] = "--detect-moved";
++ }
+ if (do_stats)
+ args[ac++] = "--stats";
+ } else {
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -398,6 +398,8 @@ to the detailed description below for a complete description. verb(
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
--detect-renamed try to find renamed files to speed the xfer
--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
-@@ -1446,6 +1448,17 @@ the bf(--partial-dir) option, that direc
+@@ -1656,6 +1658,17 @@ the bf(--partial-dir) option, that directory will be used instead. These
potential alternate-basis files will be removed as the transfer progresses.
This option conflicts with bf(--inplace) and bf(--append).