Output a backup message when verbose > 1 and we did a copy prior
[rsync/rsync.git] / testsuite / backup.test
CommitLineData
7d059d4c
WD
1#! /bin/sh
2
3# Copyright (C) 2004 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 that the --backup option works right.
9
10. "$suitedir/rsync.fns"
11
12bakdir="$tmpdir/chk"
13
14mkdir "$fromdir" "$bakdir"
15name1="$fromdir/name1"
16name2="$fromdir/name2"
17echo "This is the file" > "$name1"
18echo "This is the other file" > "$name2"
19
20checkit "$RSYNC -avv --backup --backup-dir=\"$bakdir\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
21
22$RSYNC -avv --backup "$todir/" "$chkdir/"
23
24echo "Extending the file" >> "$name1"
25echo "Extending the other file" >> "$name2"
26
27checkit "$RSYNC -avv --backup --backup-dir=\"$bakdir\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
28
4e8a085a 29diff -r $diffopt "$chkdir" "$bakdir"
7d059d4c
WD
30
31echo "Extending the file again" >> "$name1"
32echo "Extending the other file again" >> "$name2"
33
34checkit "$RSYNC -avv --inplace --backup --backup-dir=\"$bakdir\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
35
4e8a085a 36diff -r $diffopt "$chkdir" "$bakdir"
7d059d4c
WD
37
38# The script would have aborted on error, so getting here means we've won.
39exit 0