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.
17 tmpdir="$(WVPASS wvmktempdir)" || exit $?
19 export BUP_DIR="$tmpdir/bup"
20 export GIT_DIR="$BUP_DIR"
22 bup() { "$top/bup" "$@"; }
24 WVPASS mkdir -p "$tmpdir/src"
25 WVPASS mkdir -p "$tmpdir/src/d"
26 WVPASS mkdir -p "$tmpdir/src/d/e"
27 WVPASS touch "$tmpdir/src/"{f,b,a,d}
28 WVPASS touch "$tmpdir/src/d/z"
31 WVPASS bup index -u "$tmpdir/src"
33 declare -a indexed_top
35 indexed_top="${tmpdir##/}"
36 indexed_top=(${indexed_top%%/})
39 tree1=$(WVPASS bup save -t "$tmpdir/src") || exit $?
40 indexed_tree1="$(WVPASS t/subtree-hash "$tree1" "${indexed_top[@]}" src)" \
43 result="$(WVPASS cd "$tmpdir/src"; WVPASS bup index -m)" || exit $?
46 tree2=$(WVPASS bup save -t "$tmpdir/src") || exit $?
47 indexed_tree2="$(WVPASS t/subtree-hash "$tree2" "${indexed_top[@]}" src)" \
50 WVPASSEQ "$indexed_tree1" "$indexed_tree2"
52 result="$(WVPASS bup index -s / | WVFAIL grep ^D)" || exit $?
55 tree3=$(WVPASS bup save -t /) || exit $?
56 indexed_tree3="$(WVPASS t/subtree-hash "$tree3" "${indexed_top[@]}" src)" || exit $?
57 WVPASSEQ "$indexed_tree1" "$indexed_tree3"
59 WVPASS rm -rf "$tmpdir"