X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/0314302e9cbe851f05b6f4567f2c1978a38471e3..69be312b5e335430e3e896e200def6a7c6f89c8d:/testsuite/exclude.test diff --git a/testsuite/exclude.test b/testsuite/exclude.test index 23a4d976..099344f2 100644 --- a/testsuite/exclude.test +++ b/testsuite/exclude.test @@ -2,21 +2,18 @@ # 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 @@ -25,6 +22,8 @@ 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/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. @@ -92,6 +90,9 @@ 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. @@ -176,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. @@ -197,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