3 # Test that running save more than once with no other changes produces
6 # Note: we can't compare the top-level hash (i.e. the output of "save
7 # -t" because that currently pulls the metadata for unindexed parent
8 # directories directly from the filesystem, and the relevant atimes
9 # may change between runs. So instead we extract the roots of the
10 # indexed trees for comparison via t/subtree-hash.
12 . ./wvtest-bup.sh || exit $?
19 tmpdir="$(WVPASS wvmktempdir)" || exit $?
21 export BUP_DIR="$tmpdir/bup"
22 export GIT_DIR="$BUP_DIR"
24 bup() { "$top/bup" "$@"; }
26 WVPASS mkdir -p "$tmpdir/src"
27 WVPASS mkdir -p "$tmpdir/src/d"
28 WVPASS mkdir -p "$tmpdir/src/d/e"
29 WVPASS touch "$tmpdir/src/"{f,b,a,d}
30 WVPASS touch "$tmpdir/src/d/z"
33 WVPASS bup index -u "$tmpdir/src"
35 declare -a indexed_top
37 indexed_top="${tmpdir##/}"
38 indexed_top=(${indexed_top%%/})
41 tree1=$(WVPASS bup save -t "$tmpdir/src") || exit $?
42 indexed_tree1="$(WVPASS t/subtree-hash "$tree1" "${indexed_top[@]}" src)" \
45 result="$(WVPASS cd "$tmpdir/src"; WVPASS bup index -m)" || exit $?
48 tree2=$(WVPASS bup save -t "$tmpdir/src") || exit $?
49 indexed_tree2="$(WVPASS t/subtree-hash "$tree2" "${indexed_top[@]}" src)" \
52 WVPASSEQ "$indexed_tree1" "$indexed_tree2"
54 result="$(WVPASS bup index -s / | WVFAIL grep ^D)" || exit $?
57 tree3=$(WVPASS bup save -t /) || exit $?
58 indexed_tree3="$(WVPASS t/subtree-hash "$tree3" "${indexed_top[@]}" src)" || exit $?
59 WVPASSEQ "$indexed_tree1" "$indexed_tree3"
61 WVPASS rm -rf "$tmpdir"