Got rid of some fuzz.
[rsync/rsync-patches.git] / filter.diff
index d21d9d7..846f26f 100644 (file)
@@ -42,7 +42,7 @@ local instead of inherited (see also the 'n' modifier).
 
 ..wayne..
 
---- orig/clientserver.c        2005-01-01 21:11:00
+--- orig/clientserver.c        2005-01-22 22:48:52
 +++ clientserver.c     2005-01-16 23:33:02
 @@ -49,12 +49,14 @@ extern int no_detach;
  extern int default_af_hint;
@@ -60,7 +60,7 @@ local instead of inherited (see also the 'n' modifier).
  /**
   * Run a client connected to an rsyncd.  The alternative to this
   * function for remote-shell connections is do_cmd().
-@@ -304,26 +306,33 @@ static int rsync_module(int f_in, int f_
+@@ -310,26 +312,33 @@ static int rsync_module(int f_in, int f_
        /* TODO: Perhaps take a list of gids, and make them into the
         * supplementary groups. */
  
@@ -103,8 +103,8 @@ local instead of inherited (see also the 'n' modifier).
  
        log_init();
  
---- orig/exclude.c     2005-01-13 23:15:56
-+++ exclude.c  2005-01-17 05:55:59
+--- orig/exclude.c     2005-01-22 22:48:52
++++ exclude.c  2005-01-23 07:33:21
 @@ -30,15 +30,68 @@ extern int verbose;
  extern int eol_nulls;
  extern int list_only;
@@ -855,16 +855,16 @@ local instead of inherited (see also the 'n' modifier).
  
        while (1) {
                char *s = line;
-@@ -388,7 +862,7 @@ void send_exclude_list(int f)
-        * FIXME: This pattern shows up in the output of
-        * report_exclude_result(), which is not ideal. */
-       if (list_only && !recurse)
+@@ -386,7 +860,7 @@ void send_exclude_list(int f)
+       /* This is a complete hack - blame Rusty.  FIXME!
+        * Remove this hack when older rsyncs (below 2.6.4) are gone. */
+       if (list_only == 1 && !recurse)
 -              add_exclude(&exclude_list, "/*/*", 0);
 +              add_exclude(&exclude_list, "/*/*", XFLG_DEF_EXCLUDE);
  
        for (ent = exclude_list.head; ent; ent = ent->next) {
                unsigned int l;
-@@ -402,10 +876,34 @@ void send_exclude_list(int f)
+@@ -400,10 +874,34 @@ void send_exclude_list(int f)
                        p[l] = '\0';
                }
  
@@ -901,7 +901,7 @@ local instead of inherited (see also the 'n' modifier).
                        write_int(f, l + 2);
                        write_buf(f, "- ", 2);
                } else
-@@ -419,14 +917,15 @@ void send_exclude_list(int f)
+@@ -417,14 +915,15 @@ void send_exclude_list(int f)
  
  void recv_exclude_list(int f)
  {
@@ -919,7 +919,7 @@ local instead of inherited (see also the 'n' modifier).
        }
  }
  
-@@ -443,18 +942,18 @@ static char default_cvsignore[] = 
+@@ -441,18 +940,18 @@ static char default_cvsignore[] = 
  
  void add_cvs_excludes(void)
  {
@@ -944,20 +944,21 @@ local instead of inherited (see also the 'n' modifier).
 -                  XFLG_WORD_SPLIT | XFLG_WORDS_ONLY);
 +      add_exclude(&exclude_list, getenv("CVSIGNORE"), cvs_flags);
  }
---- orig/flist.c       2005-01-01 21:11:00
+--- orig/flist.c       2005-01-24 00:18:21
 +++ flist.c    2004-08-12 18:59:28
-@@ -40,10 +40,9 @@ extern int module_id;
+@@ -40,11 +40,10 @@ extern int module_id;
  extern int ignore_errors;
  extern int numeric_ids;
  
 -extern int cvs_exclude;
 -
  extern int recurse;
+ extern int xfer_dirs;
  extern char curr_dir[MAXPATHLEN];
 +extern unsigned int curr_dir_len;
- extern char *files_from;
  extern int filesfrom_fd;
  
+ extern int one_file_system;
 @@ -67,7 +66,6 @@ extern int list_only;
  
  extern struct exclude_list_struct exclude_list;
@@ -1003,7 +1004,7 @@ local instead of inherited (see also the 'n' modifier).
        }
  }
  
-@@ -1002,6 +987,7 @@ static void send_directory(int f, struct
+@@ -1004,6 +989,7 @@ static void send_directory(int f, struct
        struct dirent *di;
        char fname[MAXPATHLEN];
        unsigned int offset;
@@ -1011,7 +1012,7 @@ local instead of inherited (see also the 'n' modifier).
        char *p;
  
        d = opendir(dir);
-@@ -1025,18 +1011,7 @@ static void send_directory(int f, struct
+@@ -1027,18 +1013,7 @@ static void send_directory(int f, struct
                offset++;
        }
  
@@ -1031,7 +1032,7 @@ local instead of inherited (see also the 'n' modifier).
  
        for (errno = 0, di = readdir(d); di; errno = 0, di = readdir(d)) {
                char *dname = d_name(di);
-@@ -1057,6 +1032,8 @@ static void send_directory(int f, struct
+@@ -1060,6 +1035,8 @@ static void send_directory(int f, struct
                rsyserr(FERROR, errno, "readdir(%s)", dir);
        }
  
@@ -1040,7 +1041,7 @@ local instead of inherited (see also the 'n' modifier).
        closedir(d);
  }
  
-@@ -1076,6 +1053,7 @@ struct file_list *send_file_list(int f, 
+@@ -1079,6 +1056,7 @@ struct file_list *send_file_list(int f, 
        char *p, *dir, olddir[sizeof curr_dir];
        char lastpath[MAXPATHLEN] = "";
        struct file_list *flist;
@@ -1048,7 +1049,7 @@ local instead of inherited (see also the 'n' modifier).
        int64 start_write;
        int use_ff_fd = 0;
  
-@@ -1096,6 +1074,10 @@ struct file_list *send_file_list(int f, 
+@@ -1099,6 +1077,10 @@ struct file_list *send_file_list(int f, 
                                exit_cleanup(RERR_FILESELECT);
                        }
                        use_ff_fd = 1;
@@ -1059,9 +1060,9 @@ local instead of inherited (see also the 'n' modifier).
                }
        }
  
-@@ -1126,6 +1108,15 @@ struct file_list *send_file_list(int f, 
-                       }
-               }
+@@ -1135,6 +1117,15 @@ struct file_list *send_file_list(int f, 
+               } else if (recurse > 0)
+                       recurse = 0;
  
 +              if (need_first_push) {
 +                      if ((p = strrchr(fname, '/')) != NULL) {
@@ -1109,9 +1110,9 @@ local instead of inherited (see also the 'n' modifier).
  FN_LOCAL_STRING(lp_exclude, exclude)
  FN_LOCAL_STRING(lp_exclude_from, exclude_from)
  FN_LOCAL_STRING(lp_include, include)
---- orig/options.c     2005-01-17 23:11:45
-+++ options.c  2005-01-16 23:34:15
-@@ -144,6 +144,7 @@ int list_only = 0;
+--- orig/options.c     2005-01-24 00:18:21
++++ options.c  2005-01-23 07:33:55
+@@ -146,6 +146,7 @@ int list_only = 0;
  char *batch_name = NULL;
  
  static int daemon_opt;   /* sets am_daemon after option error-reporting */
@@ -1119,7 +1120,7 @@ local instead of inherited (see also the 'n' modifier).
  static int modify_window_set;
  static char *dest_option = NULL;
  static char *max_size_arg;
-@@ -291,6 +292,9 @@ void usage(enum logcode F)
+@@ -294,6 +295,9 @@ void usage(enum logcode F)
    rprintf(F," -P                          equivalent to --partial --progress\n");
    rprintf(F," -z, --compress              compress file data\n");
    rprintf(F," -C, --cvs-exclude           auto ignore files in the same way CVS does\n");
@@ -1129,24 +1130,24 @@ local instead of inherited (see also the 'n' modifier).
    rprintf(F,"     --exclude=PATTERN       exclude files matching PATTERN\n");
    rprintf(F,"     --exclude-from=FILE     exclude patterns listed in FILE\n");
    rprintf(F,"     --include=PATTERN       don't exclude files matching PATTERN\n");
-@@ -320,7 +324,7 @@ void usage(enum logcode F)
+@@ -324,7 +328,7 @@ void usage(enum logcode F)
  }
  
  enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
--      OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED,
-+      OPT_FILTER, OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED,
-       OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST,
+-      OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST,
++      OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST,
        OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
        OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT, OPT_MAX_SIZE,
-@@ -343,6 +347,7 @@ static struct poptOption long_options[] 
-   {"delete-excluded",  0,  POPT_ARG_NONE,   0, OPT_DELETE_EXCLUDED, 0, 0 },
+       OPT_REFUSED_BASE = 9000};
+@@ -346,6 +350,7 @@ static struct poptOption long_options[] 
+   {"delete-excluded",  0,  POPT_ARG_NONE,   &delete_excluded, 0, 0, 0 },
    {"force",            0,  POPT_ARG_NONE,   &force_delete, 0, 0, 0 },
    {"numeric-ids",      0,  POPT_ARG_NONE,   &numeric_ids, 0, 0, 0 },
 +  {"filter",          'f', POPT_ARG_STRING, 0, OPT_FILTER, 0, 0 },
    {"exclude",          0,  POPT_ARG_STRING, 0, OPT_EXCLUDE, 0, 0 },
    {"include",          0,  POPT_ARG_STRING, 0, OPT_INCLUDE, 0, 0 },
    {"exclude-from",     0,  POPT_ARG_STRING, 0, OPT_EXCLUDE_FROM, 0, 0 },
-@@ -393,6 +398,7 @@ static struct poptOption long_options[] 
+@@ -398,6 +403,7 @@ static struct poptOption long_options[] 
    {"ignore-errors",    0,  POPT_ARG_NONE,   &ignore_errors, 0, 0, 0 },
    {"blocking-io",      0,  POPT_ARG_VAL,    &blocking_io, 1, 0, 0 },
    {"no-blocking-io",   0,  POPT_ARG_VAL,    &blocking_io, 0, 0, 0 },
@@ -1154,8 +1155,8 @@ local instead of inherited (see also the 'n' modifier).
    {0,                 'P', POPT_ARG_NONE,   0, 'P', 0, 0 },
    {"port",             0,  POPT_ARG_INT,    &rsync_port, 0, 0, 0 },
    {"log-format",       0,  POPT_ARG_STRING, &log_format, 0, 0, 0 },
-@@ -622,10 +628,15 @@ int parse_arguments(int *argc, const cha
-                       delete_mode = 1;
+@@ -619,10 +625,15 @@ int parse_arguments(int *argc, const cha
+                       modify_window_set = 1;
                        break;
  
 -              case OPT_EXCLUDE:
@@ -1171,7 +1172,7 @@ local instead of inherited (see also the 'n' modifier).
                case OPT_INCLUDE:
                        add_exclude(&exclude_list, poptGetOptArg(pc),
                                    XFLG_DEF_INCLUDE);
-@@ -643,8 +654,8 @@ int parse_arguments(int *argc, const cha
+@@ -640,8 +651,8 @@ int parse_arguments(int *argc, const cha
                                        goto options_rejected;
                        }
                        add_exclude_file(&exclude_list, arg, XFLG_FATAL_ERRORS
@@ -1182,7 +1183,7 @@ local instead of inherited (see also the 'n' modifier).
                        break;
  
                case 'h':
-@@ -668,6 +679,19 @@ int parse_arguments(int *argc, const cha
+@@ -665,6 +676,19 @@ int parse_arguments(int *argc, const cha
                        am_sender = 1;
                        break;
  
@@ -1202,7 +1203,7 @@ local instead of inherited (see also the 'n' modifier).
                case 'P':
                        do_progress = 1;
                        keep_partial = 1;
-@@ -966,7 +990,7 @@ int parse_arguments(int *argc, const cha
+@@ -971,7 +995,7 @@ int parse_arguments(int *argc, const cha
                                partial_dir = NULL;
                        else if (*partial_dir != '/') {
                                add_exclude(&exclude_list, partial_dir,
@@ -1211,7 +1212,7 @@ local instead of inherited (see also the 'n' modifier).
                        }
                        keep_partial = 1;
                }
---- orig/rsync.h       2005-01-17 23:11:45
+--- orig/rsync.h       2005-01-21 00:35:26
 +++ rsync.h    2005-01-17 00:16:04
 @@ -109,9 +109,11 @@
  
@@ -1226,7 +1227,7 @@ local instead of inherited (see also the 'n' modifier).
  
  #define PERMS_REPORT          (1<<0)
  #define PERMS_SKIP_MTIME      (1<<1)
-@@ -513,11 +515,21 @@ struct map_struct {
+@@ -507,11 +509,21 @@ struct map_struct {
  #define MATCHFLG_INCLUDE      (1<<4) /* this is an include, not an exclude */
  #define MATCHFLG_DIRECTORY    (1<<5) /* this matches only directories */
  #define MATCHFLG_CLEAR_LIST   (1<<6) /* this item is the "!" token */
@@ -1249,9 +1250,9 @@ local instead of inherited (see also the 'n' modifier).
  };
  
  struct exclude_list_struct {
---- orig/rsync.yo      2005-01-17 23:11:46
-+++ rsync.yo   2005-01-17 07:02:43
-@@ -361,6 +361,9 @@ verb(
+--- orig/rsync.yo      2005-01-24 00:18:21
++++ rsync.yo   2005-01-21 19:56:38
+@@ -362,6 +362,9 @@ verb(
   -P                          equivalent to --partial --progress
   -z, --compress              compress file data
   -C, --cvs-exclude           auto ignore files in the same way CVS does
@@ -1261,7 +1262,7 @@ local instead of inherited (see also the 'n' modifier).
       --exclude=PATTERN       exclude files matching PATTERN
       --exclude-from=FILE     exclude patterns listed in FILE
       --include=PATTERN       don't exclude files matching PATTERN
-@@ -756,14 +759,41 @@ Finally, any file is ignored if it is in
+@@ -764,14 +767,41 @@ Finally, any file is ignored if it is in
  .cvsignore file and matches one of the patterns listed therein.
  See the bf(cvs(1)) manual for more information.
  
@@ -1308,7 +1309,7 @@ local instead of inherited (see also the 'n' modifier).
  
  dit(bf(--exclude-from=FILE)) This option is similar to the --exclude
  option, but instead it adds all exclude patterns listed in the file
-@@ -771,11 +801,11 @@ FILE to the exclude list.  Blank lines i
+@@ -779,11 +809,11 @@ FILE to the exclude list.  Blank lines i
  ';' or '#' are ignored.
  If em(FILE) is bf(-) the list will be read from standard input.
  
@@ -1324,7 +1325,7 @@ local instead of inherited (see also the 'n' modifier).
  
  dit(bf(--include-from=FILE)) This specifies a list of include patterns
  from a file.
-@@ -820,7 +850,8 @@ was located on the remote "src" host.
+@@ -828,7 +858,8 @@ was located on the remote "src" host.
  
  dit(bf(-0, --from0)) This tells rsync that the filenames it reads from a
  file are terminated by a null ('\0') character, not a NL, CR, or CR+LF.
@@ -1334,7 +1335,7 @@ local instead of inherited (see also the 'n' modifier).
  It does not affect --cvs-exclude (since all names read from a .cvsignore
  file are split on whitespace).
  
-@@ -959,8 +990,8 @@ If the partial-dir value is not an absol
+@@ -967,8 +998,8 @@ If the partial-dir value is not an absol
  will prevent partial-dir files from being transferred and also prevent the
  untimely deletion of partial-dir items on the receiving side.  An example:
  the above --partial-dir option would add an "--exclude=.rsync-partial/"
@@ -1345,16 +1346,16 @@ local instead of inherited (see also the 'n' modifier).
  rule for this directory exclusion somewhere higher up in the list so that
  it has a high enough priority to be effective (e.g., if your rules specify
  a trailing --exclude=* rule, the auto-added rule will be ineffective).
-@@ -1110,30 +1141,318 @@ page describing the options available fo
+@@ -1125,30 +1156,322 @@ page describing the options available fo
  
  enddit()
  
 -manpagesection(EXCLUDE PATTERNS)
-+manpagesection(FILTER RULES)
+-
 -The exclude and include patterns specified to rsync allow for flexible
 -selection of which files to transfer and which files to skip.
--
++manpagesection(FILTER RULES)
 -Rsync builds an ordered list of include/exclude options as specified on
 -the command line. Rsync checks each file and directory 
 -name against each exclude/include pattern in turn. The first matching
@@ -1368,7 +1369,7 @@ local instead of inherited (see also the 'n' modifier).
 +
 +As the list of files/directories to transfer is built, rsync checks each
 +name to be transferred against the list of include/exclude patterns in
-+turn, and t first matching pattern is acted on:  if it is an exclude
++turn, and the first matching pattern is acted on:  if it is an exclude
 +pattern, then that file is skipped; if it is an include pattern then that
 +filename is not skipped; if no matching pattern is found, then the
  filename is not skipped.
@@ -1383,14 +1384,12 @@ local instead of inherited (see also the 'n' modifier).
 +
 +itemize(
 +  it() x RULE
-+  it() x=RULE
 +  it() xMODIFIERS RULE
-+  it() xMODIFIERS=RULE
 +  it() !
 +)
 +
 +The 'x' is a single-letter that specifies the kind of rule to create.  It
-+can have trailing options, and is separated from the RULE by one of the
++can have trailing modifiers, and is separated from the RULE by one of the
 +following characters: a single space, an equal-sign (=), or an underscore
 +(_).  Here are the available rule prefixes:
 +
@@ -1402,8 +1401,8 @@ local instead of inherited (see also the 'n' modifier).
 +  !  clears the current include/exclude list
 +)
 +
-+Note that the include/exclude command-line options do not allow the full
-+range of rule parsing as described above -- they only allow the
++Note that the --include/--exclude command-line options do not allow the
++full range of rule parsing as described above -- they only allow the
 +specification of include/exclude patterns and the "!" token (not to
 +mention the comment lines when reading rules from a file).  If a pattern
 +does not begin with "- " (dash, space) or "+ " (plus, space), then the
@@ -1416,6 +1415,9 @@ local instead of inherited (see also the 'n' modifier).
 +the command-line, use the merge-file syntax of the --filter option, or
 +the --include-from/--exclude-from options.
 +
++When rules are being read from a file, empty lines are ignored, as are
++comment lines that start with a "#".
++
 +manpagesection(INCLUDE/EXCLUDE PATTERN RULES)
 +
 +You can include and exclude files by specifing patterns using the "+" and
@@ -1455,15 +1457,18 @@ local instead of inherited (see also the 'n' modifier).
 +  it() if the pattern contains a / (not counting a trailing /) or a "**"
 +  then it is matched against the full pathname, including any leading
 +  directories. If the pattern doesn't contain a / or a "**", then it is
-+  matched only against the final component of the filename.  Again,
-+  remember that the algorithm is applied recursively so "full filename" can
-+  actually be any portion of a path below the starting directory.
++  matched only against the final component of the filename.
++  (Remember that the algorithm is applied recursively so "full filename"
++  can actually be any portion of a path fomr the starting directory on
++  down.)
 +
 +)
 +
 +Note that, when using the --recursive (-r) option (which is implied by
 +-a), every subcomponent of every path is visited from the top down, so
-+include/exclude patterns get applied recursively to each subcomponent.
++include/exclude patterns get applied recursively to each subcomponent's
++full name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and
++"/foo/bar" must not be excluded).
 +The exclude patterns actually short-circuit the directory traversal stage
 +when rsync finds the files to send.  If a pattern excludes a particular
 +parent directory, it can render a deeper include pattern ineffectual
@@ -1680,7 +1685,7 @@ local instead of inherited (see also the 'n' modifier).
  
  Let's say that we want to match two source files, one with an absolute
  path of "/home/me/foo/bar", and one with a path of "/home/you/bar/baz".
-@@ -1165,114 +1484,59 @@ verb(
+@@ -1180,115 +1503,59 @@ verb(
     Target file: /dest/you/bar/baz
  )
  
@@ -1692,7 +1697,8 @@ local instead of inherited (see also the 'n' modifier).
 -Note that, when using the --recursive (-r) option (which is implied by -a),
 -every subcomponent of
 -every path is visited from the top down, so include/exclude patterns get
--applied recursively to each subcomponent.
+-applied recursively to each subcomponent's full name (e.g. to include
+-"/foo/bar/baz" the subcomponents "/foo" and "/foo/bar" must not be excluded).
 -The exclude patterns actually short-circuit the directory traversal stage
 -when rsync finds the files to send.  If a pattern excludes a particular
 -parent directory, it can render a deeper include pattern ineffectual
@@ -1732,18 +1738,18 @@ local instead of inherited (see also the 'n' modifier).
 -
 -  it() the double asterisk pattern "**" will match slashes while a
 -  single asterisk pattern "*" will stop at slashes.
--
++verb(
++  rsync -av --filter=': .excl' --exclude=.excl host:src/dir /dest
++  rsync -av --filter=':e .excl' host:src/dir /dest
++)
 -  it() if the pattern contains a / (not counting a trailing /) or a "**"
 -  then it is matched against the full filename, including any leading
 -  directory. If the pattern doesn't contain a / or a "**", then it is
 -  matched only against the final component of the filename.  Again,
 -  remember that the algorithm is applied recursively so "full filename" can
 -  actually be any portion of a path below the starting directory.
-+verb(
-+  rsync -av --filter=': .excl' --exclude=.excl host:src/dir /dest
-+  rsync -av --filter=':e .excl' host:src/dir /dest
-+)
+-
 -  it() if the pattern starts with "+ " (a plus followed by a space)
 -  then it is always considered an include pattern, even if specified as
 -  part of an exclude option. The prefix is discarded before matching.
@@ -1833,7 +1839,7 @@ local instead of inherited (see also the 'n' modifier).
  )
  
  manpagesection(BATCH MODE)
-@@ -1441,7 +1705,7 @@ it. The most common cause is incorrectly
+@@ -1457,7 +1724,7 @@ it. The most common cause is incorrectly
  scripts (such as .cshrc or .profile) that contain output statements
  for non-interactive logins.