On 8/31/06, Wayne Davison <[EMAIL PROTECTED]> wrote:
Yes, the code needs to continue to dump .cvsignore files.

That's the wrong fix.  In the presence of --delete-excluded, filters
in .cvsignore aren't ineffective because they're in .cvsignore;
they're ineffective because they are exclude filters rather than
protect filters.  Exclude filters in ordinary per-dir merge files take
effect despite --delete-excluded, and they shouldn't.  The correct fix
is to use the same criteria for immediate eliding in add_rule as for
delayed eliding in send_rules.  Of course, since .cvsignore files
happen to contain only exclude rules, eliding .cvsignore files
immediately would be a good optimization.

The attached patch fixes add_rule and adds a test for exclude filters
in ordinary per-dir merge files.  You decide whether to keep or revert
the immediate eliding of .cvsignore files; if you do, a comment
explaining that it is only an optimization would be helpful.

Matt
### Eclipse Workspace Patch 1.0
#P rsync
Index: testsuite/delete.test
===================================================================
RCS file: /cvsroot/rsync/testsuite/delete.test,v
retrieving revision 1.5
diff -u -r1.5 delete.test
--- testsuite/delete.test	31 Aug 2006 17:19:26 -0000	1.5
+++ testsuite/delete.test	31 Aug 2006 21:59:05 -0000
@@ -23,15 +23,19 @@
 
 diff -r "$chkdir/empty" "$fromdir"
 
-# Make sure that --delete-excluded does not dump a per-dir merge-file filter.
+# Make sure that "P" but not "-" per-dir merge-file filters take effect with
+# --delete-excluded.
 cat >"$todir/filters" <<EOF
 P foo
+- bar
 EOF
-touch "$todir/foo"
+touch "$todir/foo" "$todir/bar"
 
 $RSYNC -r --filter=': filters' --delete-excluded "$fromdir/" "$todir/"
 
 test -f "$todir/foo" || test_fail "rsync incorrectly elided the merge file"
+test -f "$todir/bar" && \
+	test_fail "rsync forgot that --delete-excluded makes - filters ineffective"
 
 # The script would have aborted on error, so getting here means we've won.
 exit 0
Index: exclude.c
===================================================================
RCS file: /cvsroot/rsync/exclude.c,v
retrieving revision 1.136
diff -u -r1.136 exclude.c
--- exclude.c	31 Aug 2006 17:18:24 -0000	1.136
+++ exclude.c	31 Aug 2006 21:59:05 -0000
@@ -139,7 +139,9 @@
 			if (mf == MATCHFLG_RECEIVER_SIDE)
 				return;
 		} else {
-			if (mf == MATCHFLG_SENDER_SIDE)
+			if (delete_excluded
+				? !(mf & (MATCHFLG_RECEIVER_SIDE|MATCHFLG_MERGE_FILE))
+				: (mf == MATCHFLG_SENDER_SIDE))
 				return;
 		}
 	}
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to