]> arthur.barton.de Git - bup.git/blob - t/test-save-with-valid-parent.sh
test-restore-map-owner: accommodate python 3 and test there
[bup.git] / t / test-save-with-valid-parent.sh
1 #!/usr/bin/env bash
2 . ./wvtest-bup.sh || exit $?
3 . t/lib.sh || exit $?
4
5 set -o pipefail
6
7 top="$(WVPASS pwd)" || exit $?
8 tmpdir="$(WVPASS wvmktempdir)" || exit $?
9
10 export BUP_DIR="$tmpdir/bup"
11 export GIT_DIR="$tmpdir/bup"
12
13 bup() { "$top/bup" "$@"; }
14 compare-trees() { "$top/t/compare-trees" "$@"; }
15
16 WVPASS cd "$tmpdir"
17
18 # Make sure that we can explicitly save a path whose parent is up to
19 # date.
20
21 WVSTART "save path with up to date parent"
22 WVPASS bup init
23
24 WVPASS mkdir -p src/a src/b
25 WVPASS touch src/a/1 src/b/2
26 WVPASS bup index -u src
27 WVPASS bup save -n src src
28
29 WVPASS bup save -n src src/b
30 WVPASS bup restore -C restore "src/latest/$(pwd)/"
31 WVPASS test ! -e restore/src/a
32 WVPASS "$top/t/compare-trees" -c src/b/ restore/src/b/
33
34 WVPASS bup save -n src src/a/1
35 WVPASS rm -r restore
36 WVPASS bup restore -C restore "src/latest/$(pwd)/"
37 WVPASS test ! -e restore/src/b
38 WVPASS "$top/t/compare-trees" -c src/a/ restore/src/a/
39
40 WVPASS rm -rf "$tmpdir"