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