3 # Copyright (C) 2004-2022 Wayne Davison
5 # This program is distributable under the terms of the GNU GPL (see
8 # Test rsync handling of --compare-dest and similar options.
10 .
"$suitedir/rsync.fns"
12 alt1dir
="$tmpdir/alt1"
13 alt2dir
="$tmpdir/alt2"
14 alt3dir
="$tmpdir/alt3"
16 SSH
="$scratchdir/src/support/lsh.sh"
18 # Build some files/dirs/links to copy
22 # Setup the alt and chk dirs
23 $RSYNC -av --include=text
--include='*/' --exclude='*' "$fromdir/" "$alt1dir/"
24 $RSYNC -av --include=etc-ltr-list
--include='*/' --exclude='*' "$fromdir/" "$alt2dir/"
26 # Create a side dir where there is a candidate destfile of the same name as a sourcefile
27 echo "This is a test file" >"$fromdir/likely"
30 echo "This is a test file" >"$alt3dir/likely"
33 touch "$fromdir/dir/text" "$fromdir/likely"
35 $RSYNC -av --exclude=/text
--exclude=etc-ltr-list
"$fromdir/" "$chkdir/"
38 checkit
"$RSYNC -avv --no-whole-file \
39 --compare-dest='$alt1dir' --compare-dest='$alt2dir' \
40 '$fromdir/' '$todir/'" "$chkdir" "$todir"
43 checkit
"$RSYNC -avv --no-whole-file \
44 --copy-dest='$alt1dir' --copy-dest='$alt2dir' \
45 '$fromdir/' '$todir/'" "$fromdir" "$todir"
47 # Test that copy_file() works correctly with tmpfiles
48 for maybe_inplace
in '' --inplace; do
50 checkit
"$RSYNC -av $maybe_inplace --copy-dest='$alt3dir' \
51 '$fromdir/' '$todir/'" "$fromdir" "$todir"
53 for srchost
in '' 'localhost:'; do
54 if [ -z "$srchost" ]; then
61 checkit
"$RSYNC -ave '$SSH' --rsync-path='$RSYNC' $maybe_inplace \
62 --copy-dest='$alt3dir' '$srchost$fromdir/' '$desthost$todir/'" \
67 # The script would have aborted on error, so getting here means we've won.