---- orig/options.c 2004-08-03 15:41:32
-+++ options.c 2004-08-04 08:36:48
-@@ -51,6 +51,7 @@ int preserve_gid = 0;
- int preserve_times = 0;
- int update_only = 0;
- int cvs_exclude = 0;
-+int inherit_exclude_levels = -9999;
- int dry_run = 0;
- int local_server = 0;
- int ignore_times = 0;
-@@ -287,6 +288,7 @@ void usage(enum logcode F)
- rprintf(F," --exclude-from=FILE exclude patterns listed in FILE\n");
- rprintf(F," --include=PATTERN don't exclude files matching PATTERN\n");
- rprintf(F," --include-from=FILE don't exclude patterns listed in FILE\n");
-+ rprintf(F," --inherit=DEPTH inherit contents of per-dir merge files\n");
- rprintf(F," --files-from=FILE read FILE for list of source-file names\n");
- rprintf(F," -0, --from0 all *-from file lists are delimited by nulls\n");
- rprintf(F," --version print version number\n");
-@@ -319,7 +321,7 @@ void usage(enum logcode F)
-
- enum {OPT_VERSION = 1000, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
- OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_LINK_DEST,
-- OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
-+ OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_INHERIT, OPT_MODIFY_WINDOW,
- OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT,
- OPT_REFUSED_BASE = 9000};
-
-@@ -344,6 +346,7 @@ static struct poptOption long_options[]
- {"include", 0, POPT_ARG_STRING, 0, OPT_INCLUDE, 0, 0 },
- {"exclude-from", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE_FROM, 0, 0 },
- {"include-from", 0, POPT_ARG_STRING, 0, OPT_INCLUDE_FROM, 0, 0 },
-+ {"inherit", 0, POPT_ARG_STRING, 0, OPT_INHERIT, 0, 0 },
- {"safe-links", 0, POPT_ARG_NONE, &safe_symlinks, 0, 0, 0 },
- {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0 },
- {"backup", 'b', POPT_ARG_NONE, &make_backups, 0, 0, 0 },
-@@ -566,6 +569,31 @@ int parse_arguments(int *argc, const cha
- XFLG_FATAL_ERRORS | XFLG_DEF_INCLUDE);
- break;
-
-+ case OPT_INHERIT:
-+ arg = poptGetOptArg(pc);
-+ if (isdigit(*arg))
-+ inherit_exclude_levels = atoi(arg);
-+ else if (*arg == '.') {
-+ if (!*++arg)
-+ inherit_exclude_levels = 0;
-+ else if (*arg == '.') {
-+ inherit_exclude_levels = 1;
-+ arg++;
-+ while (strncmp(arg, "/..", 3) == 0) {
-+ inherit_exclude_levels++;
-+ arg += 3;
-+ }
-+ if (*arg)
-+ inherit_exclude_levels = -1;
-+ }
+@@ -1047,6 +1024,7 @@ struct file_list *send_file_list(int f,
+ char *p, *dir, olddir[sizeof curr_dir];
+ char lastpath[MAXPATHLEN] = "";
+ struct file_list *flist;
++ void *first_push = NULL;
+ int64 start_write;
+ int use_ff_fd = 0;
+
+@@ -1067,6 +1045,14 @@ struct file_list *send_file_list(int f,
+ exit_cleanup(RERR_FILESELECT);
+ }
+ use_ff_fd = 1;
++ if (curr_dir_len < MAXPATHLEN - 1) {
++ char buf[MAXPATHLEN];
++ strcpy(buf, curr_dir);
++ buf[curr_dir_len] = '/';
++ buf[curr_dir_len+1] = '\0';
++ first_push = push_local_excludes(buf,
++ curr_dir_len+1);