The delete-during code needs to skip directories that don't exist
[rsync/rsync.git] / testsuite / delete.test
... / ...
CommitLineData
1#! /bin/sh
2
3# Copyright (C) 2005 by Wayne Davison <wayned@samba.org>
4
5# This program is distributable under the terms of the GNU GPL (see
6# COPYING).
7
8# Test rsync handling of various delete directives.
9
10. "$suitedir/rsync.fns"
11
12hands_setup
13
14makepath "$chkdir" "$todir/extradir" "$todir/emptydir/subdir"
15
16echo extra >"$todir"/remove1
17echo extra >"$todir"/remove2
18echo extra >"$todir"/extradir/remove3
19echo extra >"$todir"/emptydir/subdir/remove4
20
21# Create two chk dirs, one with a copy of the source files, and one with
22# what we expect to be left behind by the copy using --remove-source-files.
23$RSYNC -av "$fromdir/" "$chkdir/copy/"
24$RSYNC -av -f 'exclude,! */' "$fromdir/" "$chkdir/empty/"
25
26checkit "$RSYNC -avv --del --remove-source-files \
27 \"$fromdir/\" \"$todir/\"" "$chkdir/copy" "$todir"
28
29diff -r "$chkdir/empty" "$fromdir"
30
31# Make sure that "P" but not "-" per-dir merge-file filters take effect with
32# --delete-excluded.
33cat >"$todir/filters" <<EOF
34P foo
35- bar
36EOF
37touch "$todir/foo" "$todir/bar" "$todir/baz"
38
39$RSYNC -r --exclude=baz --filter=': filters' --delete-excluded "$fromdir/" "$todir/"
40
41test -f "$todir/foo" || test_fail "rsync should NOT have deleted $todir/foo"
42test -f "$todir/bar" && test_fail "rsync SHOULD have deleted $todir/bar"
43test -f "$todir/baz" && test_fail "rsync SHOULD have deleted $todir/baz"
44
45# The script would have aborted on error, so getting here means we've won.
46exit 0