From cb0d2e2b200e6610054021db977334088f9bd04f Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 17 Dec 2005 19:57:21 +0000 Subject: [PATCH] A couple parsing improvements and a new test case added to testsuite/exclude.test. --- cvs-entries.diff | 104 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/cvs-entries.diff b/cvs-entries.diff index f685ac2..a6650df 100644 --- a/cvs-entries.diff +++ b/cvs-entries.diff @@ -3,7 +3,7 @@ in each dir's CVS/Entries file as per-dir includes before the dir's list of excludes taken from the .cvsignore file. --- orig/exclude.c 2005-10-14 18:45:50 -+++ exclude.c 2005-04-07 18:06:34 ++++ exclude.c 2005-12-17 19:52:48 @@ -446,6 +446,14 @@ void *push_local_filters(const char *dir set_filter_dir(dir, dirlen); } @@ -27,46 +27,50 @@ of excludes taken from the .cvsignore file. if (!fname || !*fname) return; -@@ -1006,6 +1015,29 @@ void parse_filter_file(struct filter_lis +@@ -1006,6 +1015,24 @@ void parse_filter_file(struct filter_lis continue; break; } -+ switch (slash_parse) { -+ case 1: -+ if (ch == '/') { -+ s = line; ++ switch (slash_parse) { /* CVS/Entries parsing: */ ++ case 1: /* Ignore starting chars until first slash. */ ++ if (ch == '/') + slash_parse = 2; -+ continue; -+ } -+ break; -+ case 2: ++ continue; ++ case 2: /* Name ends at 2nd slash on the line. */ + if (ch == '/') { + slash_parse = 3; + continue; + } + break; -+ case 3: ++ case 3: /* Ignore trailing chars until EOL. */ + if (ch == '\n' || ch == '\r') { + slash_parse = 1; -+ goto double_break; ++ goto end_the_line; + } + continue; -+ default: -+ break; + } if (word_split && isspace(ch)) break; if (eol_nulls? !ch : (ch == '\n' || ch == '\r')) -@@ -1015,6 +1047,7 @@ void parse_filter_file(struct filter_lis +@@ -1015,13 +1042,15 @@ void parse_filter_file(struct filter_lis else overflow = 1; } -+ double_break: ++ end_the_line: if (overflow) { rprintf(FERROR, "discarding over-long filter: %s...\n", line); s = line; ---- orig/rsync.h 2005-10-14 18:45:50 -+++ rsync.h 2005-10-14 19:17:51 + } + *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 (ch == EOF) + break; +--- orig/rsync.h 2005-12-15 23:00:49 ++++ rsync.h 2005-12-17 19:52:48 @@ -116,6 +116,7 @@ #define XFLG_OLD_PREFIXES (1<<1) #define XFLG_ANCHORED2ABS (1<<2) @@ -75,3 +79,67 @@ of excludes taken from the .cvsignore file. #define PERMS_REPORT (1<<0) #define PERMS_SKIP_MTIME (1<<1) +--- orig/testsuite/exclude.test 2005-02-26 19:47:43 ++++ testsuite/exclude.test 2005-12-17 19:52:49 +@@ -21,6 +21,7 @@ set -x + # Build some files/dirs/links to copy + + makepath "$fromdir/foo/down/to/you" ++makepath "$fromdir/bar/down/to/CVS" + makepath "$fromdir/bar/down/to/foo/too" + makepath "$fromdir/bar/down/to/bar/baz" + makepath "$fromdir/mid/for/foo/and/that/is/who" +@@ -56,6 +57,9 @@ echo cvsout >"$fromdir/bar/down/to/foo/f + 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 cvsin >"$fromdir/bar/down/to/not.junk" ++echo cvsout >"$fromdir/bar/down/to/not.good" ++echo cvsout >"$fromdir/bar/down/to/D" + 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" <"$excl" <"$scratchdir/.cvsignore" <"$fromdir/bar/down/to/CVS/Entries" <"$fromdir/bar/down/to/.cvsignore" <