./configure (optional if already run)
make
---- old/exclude.c
-+++ new/exclude.c
-@@ -217,6 +217,8 @@ static void add_rule(struct filter_list_
- if (!(lp = new_array(struct filter_list_struct, 1)))
+based-on: 24079e988fc31af4eba56cd2701fdc5a4154980d
+diff --git a/exclude.c b/exclude.c
+--- a/exclude.c
++++ b/exclude.c
+@@ -267,6 +267,8 @@ static void add_rule(filter_rule_list *listp, const char *pat, unsigned int pat_
+ if (!(lp = new_array(filter_rule_list, 1)))
out_of_memory("add_rule");
- lp->head = lp->tail = NULL;
+ lp->head = lp->tail = lp->parent_dirscan_head = NULL;
+ if (mflags & MATCHFLG_CVS_IGNORE)
+ cp = "CVS";
if (asprintf(&lp->debug_type, " [per-dir %s]", cp) < 0)
out_of_memory("add_rule");
- ret->u.mergelist = lp;
-@@ -449,6 +451,14 @@ void *push_local_filters(const char *dir
+ rule->u.mergelist = lp;
+@@ -526,6 +528,14 @@ void *push_local_filters(const char *dir, unsigned int dirlen)
set_filter_dir(dir, dirlen);
}
+ }
if (strlcpy(dirbuf + dirbuf_len, ex->pattern,
MAXPATHLEN - dirbuf_len) < MAXPATHLEN - dirbuf_len) {
- parse_filter_file(lp, dirbuf, ex->match_flags,
-@@ -1005,6 +1015,7 @@ void parse_filter_file(struct filter_lis
+ parse_filter_file(lp, dirbuf, ex,
+@@ -1151,6 +1161,7 @@ void parse_filter_file(filter_rule_list *listp, const char *fname, const filter_
char line[BIGPATHBUFLEN];
char *eob = line + sizeof line - 1;
- int word_split = mflags & MATCHFLG_WORD_SPLIT;
+ BOOL word_split = (template->rflags & FILTRULE_WORD_SPLIT) != 0;
+ int slash_parse = xflags & XFLG_CVS_ENTRIES ? 1 : 0;
if (!fname || !*fname)
return;
-@@ -1051,6 +1062,24 @@ void parse_filter_file(struct filter_lis
+@@ -1197,6 +1208,24 @@ void parse_filter_file(filter_rule_list *listp, const char *fname, const filter_
}
break;
}
if (word_split && isspace(ch))
break;
if (eol_nulls? !ch : (ch == '\n' || ch == '\r'))
-@@ -1060,13 +1089,15 @@ void parse_filter_file(struct filter_lis
+@@ -1206,13 +1235,14 @@ void parse_filter_file(filter_rule_list *listp, const char *fname, const filter_
else
overflow = 1;
}
*s = '\0';
/* Skip an empty token and (when line parsing) comments. */
- if (*line && (word_split || (*line != ';' && *line != '#')))
-+ if (*line && (word_split || slash_parse
-+ || (*line != ';' && *line != '#')))
- parse_rule(listp, line, mflags, xflags);
++ if (*line && (word_split || slash_parse || (*line != ';' && *line != '#')))
+ parse_filter_str(listp, line, template, xflags);
if (ch == EOF)
break;
---- old/rsync.h
-+++ new/rsync.h
-@@ -132,6 +132,7 @@
- #define XFLG_OLD_PREFIXES (1<<1)
- #define XFLG_ANCHORED2ABS (1<<2)
- #define XFLG_ABS_IF_SLASH (1<<3)
-+#define XFLG_CVS_ENTRIES (1<<4)
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -157,6 +157,7 @@
+ #define XFLG_ANCHORED2ABS (1<<2) /* leading slash indicates absolute */
+ #define XFLG_ABS_IF_SLASH (1<<3) /* leading or interior slash is absolute */
+ #define XFLG_DIR2WILD3 (1<<4) /* dir/ match gets trailing *** added */
++#define XFLG_CVS_ENTRIES (1<<5)
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
---- old/testsuite/exclude.test
-+++ new/testsuite/exclude.test
+diff --git a/testsuite/exclude.test b/testsuite/exclude.test
+--- a/testsuite/exclude.test
++++ b/testsuite/exclude.test
@@ -19,6 +19,7 @@ export CVSIGNORE
makepath "$fromdir/foo/down/to/you"
makepath "$fromdir/bar/down/to/foo/too"
makepath "$fromdir/bar/down/to/bar/baz"
makepath "$fromdir/mid/for/foo/and/that/is/who"
-@@ -57,6 +58,9 @@ echo cvsout >"$fromdir/bar/down/to/foo/f
+@@ -57,6 +58,9 @@ echo cvsout >"$fromdir/bar/down/to/foo/file1.bak"
echo gone >"$fromdir/bar/down/to/foo/file3"
echo lost >"$fromdir/bar/down/to/foo/file4"
echo weird >"$fromdir/bar/down/to/foo/+ file3"
echo cvsout-but-filtin >"$fromdir/bar/down/to/foo/file4.junk"
echo smashed >"$fromdir/bar/down/to/foo/to"
cat >"$fromdir/bar/down/to/bar/.filt2" <<EOF
-@@ -103,7 +107,18 @@ cat >"$excl" <<EOF
+@@ -102,7 +106,18 @@ cat >"$excl" <<EOF
EOF
cat >"$scratchdir/.cvsignore" <<EOF
+not.good
EOF
- # Create the chk dir with what we expect to be excluded
-@@ -132,6 +147,10 @@ checkit "$RSYNC -avv --exclude-from=\"$e
+ # Start with a check of --prune-empty-dirs:
+@@ -136,6 +151,10 @@ checkit "$RSYNC -avv --exclude-from='$excl' \
# Modify the chk dir by removing cvs-ignored files and then tweaking the dir times.
rm "$chkdir"/foo/*.old
rm "$chkdir"/bar/down/to/foo/*.bak
rm "$chkdir"/bar/down/to/foo/*.junk
rm "$chkdir"/bar/down/to/home-cvs-exclude
-@@ -147,8 +166,12 @@ checkit "$RSYNC -avvC --filter=\"merge $
+@@ -151,8 +170,12 @@ checkit "$RSYNC -avvC --filter='merge $excl' --delete-excluded \
# Modify the chk dir for our merge-exclude test and then tweak the dir times.
+makepath "$chkdir/bar/down/to/CVS"
rm "$chkdir"/foo/file1
rm "$chkdir"/bar/down/to/bar/baz/*.deep
-+cp -p "$fromdir"/bar/down/to/D "$chkdir"/bar/down/to/D
-+cp -p "$fromdir"/bar/down/to/not.good "$chkdir"/bar/down/to/not.good
-+cp -p "$fromdir"/bar/down/to/CVS/Entries "$chkdir"/bar/down/to/CVS/Entries
- cp -p "$fromdir"/bar/down/to/foo/*.junk "$chkdir"/bar/down/to/foo
- cp -p "$fromdir"/bar/down/to/foo/to "$chkdir"/bar/down/to/foo
++cp_touch "$fromdir"/bar/down/to/D "$chkdir"/bar/down/to/D
++cp_touch "$fromdir"/bar/down/to/not.good "$chkdir"/bar/down/to/not.good
++cp_touch "$fromdir"/bar/down/to/CVS/Entries "$chkdir"/bar/down/to/CVS/Entries
+ cp_touch "$fromdir"/bar/down/to/foo/*.junk "$chkdir"/bar/down/to/foo
+ cp_touch "$fromdir"/bar/down/to/foo/to "$chkdir"/bar/down/to/foo