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.
19 tmpdir="$(wvmktempdir)"
20 export BUP_DIR="$tmpdir/bup"
21 export GIT_DIR="$BUP_DIR"
23 bup() { "$top/bup" "$@"; }
25 mkdir -p "$tmpdir/src"
26 mkdir -p "$tmpdir/src/d"
27 mkdir -p "$tmpdir/src/d/e"
28 touch "$tmpdir/src/"{f,b,a,d}
29 touch "$tmpdir/src/d/z"
32 WVPASS bup index -u "$tmpdir/src"
34 declare -a indexed_top
36 indexed_top="${tmpdir##/}"
37 indexed_top=(${indexed_top%%/})
40 tree1=$(bup save -t "$tmpdir/src") || WVFAIL
41 indexed_tree1="$(t/subtree-hash "$tree1" "${indexed_top[@]}" src)"
43 WVPASSEQ "$(cd "$tmpdir/src" && bup index -m)" ""
45 tree2=$(bup save -t "$tmpdir/src") || WVFAIL
46 indexed_tree2="$(t/subtree-hash "$tree2" "${indexed_top[@]}" src)"
48 WVPASSEQ "$indexed_tree1" "$indexed_tree2"
50 WVPASSEQ "$(bup index -s / | grep ^D)" ""
52 tree3=$(bup save -t /) || WVFAIL
53 indexed_tree3="$(t/subtree-hash "$tree3" "${indexed_top[@]}")"
55 WVPASSEQ "$indexed_tree3" "$indexed_tree3"