X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/13725744fde97fd9e511adb118ee2c9389116243..a055dbdd883a3c04318e13211c3ef7942314bee7:/testsuite/exclude.test diff --git a/testsuite/exclude.test b/testsuite/exclude.test index 9c7b038a..099344f2 100644 --- a/testsuite/exclude.test +++ b/testsuite/exclude.test @@ -2,28 +2,28 @@ # Copyright (C) 2003, 2004, 2005 by Wayne Davison -# This program is distributable under the terms of the GNU GPL see +# This program is distributable under the terms of the GNU GPL (see # COPYING). -# Test rsync handling of exclude/include directives. +# Test rsync handling of exclude/include directives. # Test some of the more obscure wildcard handling of exclude/include # processing. . "$suitedir/rsync.fns" -HOME="$scratchdir" CVSIGNORE='*.junk' -export HOME CVSIGNORE - -set -x +export CVSIGNORE # Build some files/dirs/links to copy makepath "$fromdir/foo/down/to/you" +makepath "$fromdir/foo/sub" makepath "$fromdir/bar/down/to/foo/too" makepath "$fromdir/bar/down/to/bar/baz" makepath "$fromdir/mid/for/foo/and/that/is/who" +makepath "$fromdir/new/keep/this" +makepath "$fromdir/new/lose/this" cat >"$fromdir/.filt" <"$fromdir/foo/file1" +echo filtered-1 >"$fromdir/foo/file1" echo removed >"$fromdir/foo/file2" echo cvsout >"$fromdir/foo/file2.old" cat >"$fromdir/foo/.filt" <"$fromdir/foo/sub/file1" cat >"$fromdir/bar/.filt" <"$fromdir/mid/for/one-in-one-out" echo expunged >"$fromdir/mid/for/foo/extra" echo retained >"$fromdir/mid/for/foo/keep" -ln -s too "$fromdir/bar/down/to/foo/sym" # Setup our test exclude/include files. @@ -87,8 +87,12 @@ cat >"$excl" <"$scratchdir/.cvsignore" <"$todir"/bar/down/to/bar/baz/nodel.deep -cp -p "$todir"/bar/down/to/bar/baz/nodel.deep "$chkdir"/bar/down/to/bar/baz +cp_touch "$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\" | +checkit "sed '/!/d' '$excl' | $RSYNC -avv -f dir-merge_.filt -f merge_- \ - --delete-during \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir" + --delete-during '$fromdir/' '$todir/'" "$chkdir" "$todir" # Remove the files that will be deleted. @@ -173,9 +184,9 @@ $RSYNC -av --protocol=28 --existing --include='*/' --exclude='*' "$fromdir/" "$c # Now, try the prior command with --delete-before and some side-specific # rules. -checkit "sed '/!/d' \"$excl\" | +checkit "sed '/!/d' '$excl' | $RSYNC -avv -f :s_.filt -f .s_- -f P_nodel.deep \ - --delete-before \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir" + --delete-before '$fromdir/' '$todir/'" "$chkdir" "$todir" # Next, we'll test some rule-restricted filter files. @@ -194,7 +205,15 @@ $RSYNC -av --existing --filter='-! */' "$fromdir/" "$chkdir/" $RSYNC -av --delete-excluded --exclude='*' "$fromdir/" "$todir/" checkit "$RSYNC -avv -f dir-merge,-_.excl \ - \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir" + '$fromdir/' '$todir/'" "$chkdir" "$todir" + +relative_opts='--relative --chmod=Du+w --copy-unsafe-links' +$RSYNC -av $relative_opts "$fromdir/foo" "$chkdir/" +rm -rf "$chkdir$fromdir/foo/down" +$RSYNC -av $relative_opts --existing --filter='-! */' "$fromdir/foo" "$chkdir/" + +checkit "$RSYNC -avv $relative_opts --exclude='$fromdir/foo/down' \ + '$fromdir/foo' '$todir'" "$chkdir$fromdir/foo" "$todir$fromdir/foo" # The script would have aborted on error, so getting here means we've won. exit 0