| 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. |
| 4 | |
| 5 | --- orig/exclude.c 2005-04-28 15:56:50 |
| 6 | +++ exclude.c 2005-04-07 18:06:34 |
| 7 | @@ -442,6 +442,14 @@ void *push_local_filters(const char *dir |
| 8 | set_filter_dir(dir, dirlen); |
| 9 | } |
| 10 | |
| 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, |
| 17 | + XFLG_CVS_ENTRIES); |
| 18 | + } |
| 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 | @@ -957,6 +965,7 @@ void parse_filter_file(struct filter_lis |
| 23 | char line[MAXPATHLEN+MAX_RULE_PREFIX+1]; /* +1 for trailing slash. */ |
| 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; |
| 27 | |
| 28 | if (!fname || !*fname) |
| 29 | return; |
| 30 | @@ -1001,6 +1010,29 @@ void parse_filter_file(struct filter_lis |
| 31 | continue; |
| 32 | break; |
| 33 | } |
| 34 | + switch (slash_parse) { |
| 35 | + case 1: |
| 36 | + if (ch == '/') { |
| 37 | + s = line; |
| 38 | + slash_parse = 2; |
| 39 | + continue; |
| 40 | + } |
| 41 | + break; |
| 42 | + case 2: |
| 43 | + if (ch == '/') { |
| 44 | + slash_parse = 3; |
| 45 | + continue; |
| 46 | + } |
| 47 | + break; |
| 48 | + case 3: |
| 49 | + if (ch == '\n' || ch == '\r') { |
| 50 | + slash_parse = 1; |
| 51 | + goto double_break; |
| 52 | + } |
| 53 | + continue; |
| 54 | + default: |
| 55 | + break; |
| 56 | + } |
| 57 | if (word_split && isspace(ch)) |
| 58 | break; |
| 59 | if (eol_nulls? !ch : (ch == '\n' || ch == '\r')) |
| 60 | @@ -1010,6 +1042,7 @@ void parse_filter_file(struct filter_lis |
| 61 | else |
| 62 | overflow = 1; |
| 63 | } |
| 64 | + double_break: |
| 65 | if (overflow) { |
| 66 | rprintf(FERROR, "discarding over-long filter: %s...\n", line); |
| 67 | s = line; |
| 68 | --- orig/rsync.h 2005-05-03 17:11:01 |
| 69 | +++ rsync.h 2005-04-07 18:06:34 |
| 70 | @@ -115,6 +115,7 @@ |
| 71 | #define XFLG_FATAL_ERRORS (1<<0) |
| 72 | #define XFLG_OLD_PREFIXES (1<<1) |
| 73 | #define XFLG_ANCHORED2ABS (1<<2) |
| 74 | +#define XFLG_CVS_ENTRIES (1<<3) |
| 75 | |
| 76 | #define PERMS_REPORT (1<<0) |
| 77 | #define PERMS_SKIP_MTIME (1<<1) |