summaryrefslogtreecommitdiff
path: root/testsuite/merge.test
blob: 2c3844cc08daea745f2550bf494208777de93ab4 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/sh

# Copyright (C) 2004 by Wayne Davison <wayned@samba.org>

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

# Make sure we can merge files from multiple directories into one.

. "$suitedir/rsync.fns"

# Build some files/dirs/links to copy

# Use local dirnames to better exercise the arg-parsing code.
cd "$tmpdir"

mkdir from1 from2 from3
mkdir from2/sub1 from3/sub1
mkdir from3/sub2 from1/dir-and-not-dir
mkdir -p chk/sub1 chk/sub2 chk/dir-and-not-dir
echo "one" >from1/one
cp -p from1/one from2/one
cp -p from1/one from3/one
echo "two" >from1/two
echo "three" >from2/three
echo "four" >from3/four
echo "five" >from1/five
echo "six" >from3/six
echo "sub1" >from2/sub1/uno
cp -p from2/sub1/uno from3/sub1/uno
echo "sub2" >from3/sub1/dos
echo "sub3" >from2/sub1/tres
echo "subby" >from3/sub2/subby
echo "extra" >from1/dir-and-not-dir/inside
echo "not-dir" >from3/dir-and-not-dir

cp -p from1/one from1/two from2/three from3/four from1/five from3/six chk
cp -p from1/dir-and-not-dir/inside chk/dir-and-not-dir
cp -p from2/sub1/uno from3/sub1/dos from2/sub1/tres chk/sub1
cp -p from3/sub2/subby chk/sub2

# Get rid of any directory-time differences
$RSYNC -av --existing -f 'exclude,! */' from1/ from2/
$RSYNC -av --existing -f 'exclude,! */' from2/ from3/
$RSYNC -av --existing -f 'exclude,! */' from1/ chk/
$RSYNC -av --existing -f 'exclude,! */' from3/ chk/

# TODO: fix inc-recurse unduplications of directory contents!
checkit "$RSYNC -avv --no-ir from1/ from2/ from3/ to/" chk to

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