summaryrefslogtreecommitdiff
path: root/testsuite/compare-dest.test
blob: ff2af33c03ac1e077132baf4459217876049decf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

# Copyright (C) 2004-2021 Wayne Davison

# This program is distributable under the terms of the GNU GPL (see
# COPYING).

# Test rsync handling of the --compare-dest option.

. "$suitedir/rsync.fns"

alt1dir="$tmpdir/alt1"
alt2dir="$tmpdir/alt2"

# Build some files/dirs/links to copy

hands_setup

# Setup the alt and chk dirs
$RSYNC -av --include=text --include='*/' --exclude='*' "$fromdir/" "$alt1dir/"
$RSYNC -av --include=etc-ltr-list --include='*/' --exclude='*' "$fromdir/" "$alt2dir/"

sleep 1
touch "$fromdir/dir/text"

$RSYNC -av --exclude=/text --exclude=etc-ltr-list "$fromdir/" "$chkdir/"

# Let's do it!
checkit "$RSYNC -avv --no-whole-file \
    --compare-dest='$alt1dir' --compare-dest='$alt2dir' \
    '$fromdir/' '$todir/'" "$chkdir" "$todir"
checkit "$RSYNC -avv --no-whole-file \
    --copy-dest='$alt1dir' --copy-dest='$alt2dir' \
    '$fromdir/' '$todir/'" "$fromdir" "$todir"

# The script would have aborted on error, so getting here means we've won.
exit 0