1 This patch causes the --cvs-exclude option to prefix the names listed
2 in each dir's CVS/Entries file as per-dir includes before the dir's list
3 of excludes taken from the .cvsignore file.
5 --- orig/exclude.c 2005-10-14 18:45:50
6 +++ exclude.c 2005-12-17 19:52:48
7 @@ -446,6 +446,14 @@ void *push_local_filters(const char *dir
8 set_filter_dir(dir, dirlen);
11 + if (ex->match_flags & MATCHFLG_CVS_IGNORE
12 + && strlcpy(dirbuf + dirbuf_len, "CVS/Entries",
13 + MAXPATHLEN - dirbuf_len) < MAXPATHLEN - dirbuf_len) {
14 + /* Start by adding include rules for all the names in CVS/Entries. */
15 + parse_filter_file(lp, dirbuf,
16 + MATCHFLG_NO_PREFIXES | MATCHFLG_INCLUDE,
19 if (strlcpy(dirbuf + dirbuf_len, ex->pattern,
20 MAXPATHLEN - dirbuf_len) < MAXPATHLEN - dirbuf_len) {
21 parse_filter_file(lp, dirbuf, ex->match_flags,
22 @@ -962,6 +970,7 @@ void parse_filter_file(struct filter_lis
23 char line[BIGPATHBUFLEN];
24 char *eob = line + sizeof line - 1;
25 int word_split = mflags & MATCHFLG_WORD_SPLIT;
26 + int slash_parse = xflags & XFLG_CVS_ENTRIES ? 1 : 0;
28 if (!fname || !*fname)
30 @@ -1006,6 +1015,24 @@ void parse_filter_file(struct filter_lis
34 + switch (slash_parse) { /* CVS/Entries parsing: */
35 + case 1: /* Ignore starting chars until first slash. */
39 + case 2: /* Name ends at 2nd slash on the line. */
45 + case 3: /* Ignore trailing chars until EOL. */
46 + if (ch == '\n' || ch == '\r') {
52 if (word_split && isspace(ch))
54 if (eol_nulls? !ch : (ch == '\n' || ch == '\r'))
55 @@ -1015,13 +1042,15 @@ void parse_filter_file(struct filter_lis
61 rprintf(FERROR, "discarding over-long filter: %s...\n", line);
65 /* Skip an empty token and (when line parsing) comments. */
66 - if (*line && (word_split || (*line != ';' && *line != '#')))
67 + if (*line && (word_split || slash_parse
68 + || (*line != ';' && *line != '#')))
69 parse_rule(listp, line, mflags, xflags);
72 --- orig/rsync.h 2005-12-15 23:00:49
73 +++ rsync.h 2005-12-17 19:52:48
75 #define XFLG_OLD_PREFIXES (1<<1)
76 #define XFLG_ANCHORED2ABS (1<<2)
77 #define XFLG_ABS_IF_SLASH (1<<3)
78 +#define XFLG_CVS_ENTRIES (1<<4)
80 #define PERMS_REPORT (1<<0)
81 #define PERMS_SKIP_MTIME (1<<1)
82 --- orig/testsuite/exclude.test 2005-02-26 19:47:43
83 +++ testsuite/exclude.test 2005-12-17 19:52:49
84 @@ -21,6 +21,7 @@ set -x
85 # Build some files/dirs/links to copy
87 makepath "$fromdir/foo/down/to/you"
88 +makepath "$fromdir/bar/down/to/CVS"
89 makepath "$fromdir/bar/down/to/foo/too"
90 makepath "$fromdir/bar/down/to/bar/baz"
91 makepath "$fromdir/mid/for/foo/and/that/is/who"
92 @@ -56,6 +57,9 @@ echo cvsout >"$fromdir/bar/down/to/foo/f
93 echo gone >"$fromdir/bar/down/to/foo/file3"
94 echo lost >"$fromdir/bar/down/to/foo/file4"
95 echo weird >"$fromdir/bar/down/to/foo/+ file3"
96 +echo cvsin >"$fromdir/bar/down/to/not.junk"
97 +echo cvsout >"$fromdir/bar/down/to/not.good"
98 +echo cvsout >"$fromdir/bar/down/to/D"
99 echo cvsout-but-filtin >"$fromdir/bar/down/to/foo/file4.junk"
100 echo smashed >"$fromdir/bar/down/to/foo/to"
101 cat >"$fromdir/bar/down/to/bar/.filt2" <<EOF
102 @@ -98,7 +102,18 @@ cat >"$excl" <<EOF
105 cat >"$scratchdir/.cvsignore" <<EOF
109 +cat >"$fromdir/bar/down/to/CVS/Entries" <<EOF
110 +/not.junk/1.1/Mon Jan 1 11:11:11 2001//
112 +/another.file/1.1/Tue Jan 1 22:22:22 2002//
113 +invalid lines should just be ignored...
117 +cat >"$fromdir/bar/down/to/.cvsignore" <<EOF
121 # Create the chk dir with what we expect to be excluded
122 @@ -125,6 +140,10 @@ checkit "$RSYNC -avv --exclude-from=\"$e
123 # Modify the chk dir by removing cvs-ignored files and then tweaking the dir times.
125 rm "$chkdir"/foo/*.old
126 +rm "$chkdir"/bar/down/to/D
127 +rm "$chkdir"/bar/down/to/CVS/Entries
128 +rmdir "$chkdir"/bar/down/to/CVS
129 +rm "$chkdir"/bar/down/to/not.good
130 rm "$chkdir"/bar/down/to/foo/*.bak
131 rm "$chkdir"/bar/down/to/foo/*.junk
132 rm "$chkdir"/bar/down/to/home-cvs-exclude
133 @@ -140,8 +159,12 @@ checkit "$RSYNC -avvC --filter=\"merge $
135 # Modify the chk dir for our merge-exclude test and then tweak the dir times.
137 +makepath "$chkdir/bar/down/to/CVS"
138 rm "$chkdir"/foo/file1
139 rm "$chkdir"/bar/down/to/bar/baz/*.deep
140 +cp -p "$fromdir"/bar/down/to/D "$chkdir"/bar/down/to/D
141 +cp -p "$fromdir"/bar/down/to/not.good "$chkdir"/bar/down/to/not.good
142 +cp -p "$fromdir"/bar/down/to/CVS/Entries "$chkdir"/bar/down/to/CVS/Entries
143 cp -p "$fromdir"/bar/down/to/foo/*.junk "$chkdir"/bar/down/to/foo
144 cp -p "$fromdir"/bar/down/to/foo/to "$chkdir"/bar/down/to/foo