+checkit "$RSYNC -avvC --filter=\"merge $excl\" --delete-excluded \
+ --delete-during \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
+
+# Modify the chk dir for our merge-exclude test and then tweak the dir times.
+
+rm "$chkdir"/foo/file1
+rm "$chkdir"/bar/down/to/bar/baz/*.deep
+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
+
+$RSYNC -av --existing -f 'show .filt*' -f 'hide,! */' --del "$fromdir/" "$todir/"
+
+echo retained >"$todir"/bar/down/to/bar/baz/nodel.deep
+cp -p "$todir"/bar/down/to/bar/baz/nodel.deep "$chkdir"/bar/down/to/bar/baz
+
+$RSYNC -av --existing --filter='-! */' "$fromdir/" "$chkdir/"
+
+# Now, test if rsync excludes the same files, this time with a merge-exclude
+# file.
+
+checkit "sed '/!/d' \"$excl\" |
+ $RSYNC -avv -f dir-merge_.filt -f merge_- \
+ --delete-during \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
+
+# Remove the files that will be deleted.
+
+rm "$chkdir"/.filt
+rm "$chkdir"/bar/.filt
+rm "$chkdir"/bar/down/to/.filt2
+rm "$chkdir"/bar/down/to/foo/.filt2
+rm "$chkdir"/bar/down/to/bar/.filt2
+rm "$chkdir"/mid/.filt
+
+$RSYNC -av --protocol=28 --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
+
+# Now, try the prior command with --delete-before and some side-specific
+# rules.
+
+checkit "sed '/!/d' \"$excl\" |
+ $RSYNC -avv -f :s_.filt -f .s_- -f P_nodel.deep \
+ --delete-before \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
+
+# Next, we'll test some rule-restricted filter files.
+
+cat >"$fromdir/bar/down/.excl" <<EOF
+file3
+EOF
+cat >"$fromdir/bar/down/to/foo/.excl" <<EOF
++ file3
+*.bak
+EOF
+$RSYNC -av --del "$fromdir/" "$chkdir/"
+rm "$chkdir/bar/down/to/foo/file1.bak"
+rm "$chkdir/bar/down/to/foo/file3"
+rm "$chkdir/bar/down/to/foo/+ file3"
+$RSYNC -av --existing --filter='-! */' "$fromdir/" "$chkdir/"
+$RSYNC -av --delete-excluded --exclude='*' "$fromdir/" "$todir/"
+
+checkit "$RSYNC -avv -f dir-merge,-_.excl \
+ \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"