]> arthur.barton.de Git - bup.git/blob - t/test-cat-file.sh
Ignore atime when testing bup cat-file --meta.
[bup.git] / t / test-cat-file.sh
1 #!/usr/bin/env bash
2 . ./wvtest-bup.sh
3
4 set -eo pipefail
5
6 top="$(pwd)"
7 tmpdir="$(wvmktempdir)"
8 export BUP_DIR="$tmpdir/bup"
9 export GIT_DIR="$tmpdir/bup"
10
11 bup() { "$top/bup" "$@"; }
12
13 bup init
14 cd "$tmpdir"
15
16 WVSTART "cat-file"
17 mkdir src
18 date > src/foo
19 WVPASS bup index src
20 WVPASS bup save -n src src
21 WVPASS bup cat-file "src/latest/$(pwd)/src/foo" > cat-foo
22 WVPASS diff -u src/foo cat-foo
23
24 WVSTART "cat-file --meta"
25 WVPASS bup meta --create --no-paths src/foo > src-foo.meta
26 WVPASS bup cat-file --meta "src/latest/$(pwd)/src/foo" > cat-foo.meta
27 WVPASS diff -u \
28     <(bup meta -tvvf src-foo.meta | grep -vE '^atime: ') \
29     <(bup meta -tvvf cat-foo.meta | grep -vE '^atime: ')
30
31 WVSTART "cat-file --bupm"
32 WVPASS bup cat-file --bupm "src/latest/$(pwd)/src/" > bup-cat-bupm
33 src_hash=$(bup ls -s "src/latest/$(pwd)" | cut -d' ' -f 1)
34 bupm_hash=$(git ls-tree "$src_hash" | grep -F .bupm | cut -d' ' -f 3)
35 bupm_hash=$(echo "$bupm_hash" | cut -d' ' -f 1)
36 git cat-file blob "$bupm_hash" > git-cat-bupm
37 WVPASS cmp -b git-cat-bupm bup-cat-bupm
38
39 rm -rf "$tmpdir"