6 top="$(WVPASS pwd)" || exit $?
7 tmpdir="$(WVPASS wvmktempdir)" || exit $?
9 export BUP_DIR="$tmpdir/bup"
10 export GIT_DIR="$tmpdir/bup"
12 bup() { "$top/bup" "$@"; }
18 # bup index --exclude-rx ...
19 # ==========================
21 WVSTART "index --exclude-rx '^/foo' (root anchor)"
22 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
29 WVPASS touch src/sub1/a
30 WVPASS touch src/sub2/b
31 WVPASS bup index -u src --exclude-rx "^$(pwd)/src/sub1/"
32 WVPASS bup save --strip -n bupdir src
33 WVPASS bup restore -C buprestore.tmp /bupdir/latest/
34 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
41 WVSTART "index --exclude-rx '/foo$' (non-dir, tail anchor)"
42 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
49 WVPASS mkdir src/sub/foo
50 WVPASS touch src/sub/foo/a
51 WVPASS bup index -u src --exclude-rx '/foo$'
52 WVPASS bup save --strip -n bupdir src
53 WVPASS bup restore -C buprestore.tmp /bupdir/latest/
54 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
62 WVSTART "index --exclude-rx '/foo/$' (dir, tail anchor)"
63 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
70 WVPASS mkdir src/sub/foo
71 WVPASS touch src/sub/foo/a
72 WVPASS bup index -u src --exclude-rx '/foo/$'
73 WVPASS bup save --strip -n bupdir src
74 WVPASS bup restore -C buprestore.tmp /bupdir/latest/
75 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
82 WVSTART "index --exclude-rx '/foo/.' (dir content)"
83 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
90 WVPASS mkdir src/sub/foo
91 WVPASS touch src/sub/foo/a
92 WVPASS bup index -u src --exclude-rx '/foo/.'
93 WVPASS bup save --strip -n bupdir src
94 WVPASS bup restore -C buprestore.tmp /bupdir/latest/
95 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
104 # bup index --exclude-rx-from ...
105 # ===============================
106 WVSTART "index --exclude-rx-from"
107 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
112 WVPASS mkdir src/sub1
113 WVPASS mkdir src/sub2
114 WVPASS touch src/sub1/a
115 WVPASS touch src/sub2/b
116 WVPASS echo "^$(pwd)/src/sub1/" > exclude-rx-file
117 WVPASS bup index -u src --exclude-rx-from exclude-rx-file
118 WVPASS bup save --strip -n bupdir src
119 WVPASS bup restore -C buprestore.tmp /bupdir/latest/
120 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
121 WVPASSEQ "$actual" ".
128 # bup restore --exclude-rx ...
129 # ============================
131 WVSTART "restore --exclude-rx '^/foo' (root anchor)"
132 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
137 WVPASS mkdir src/sub1
138 WVPASS mkdir src/sub2
139 WVPASS touch src/sub1/a
140 WVPASS touch src/sub2/b
141 WVPASS bup index -u src
142 WVPASS bup save --strip -n bupdir src
143 WVPASS bup restore -C buprestore.tmp --exclude-rx "^/sub1/" /bupdir/latest/
144 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
145 WVPASSEQ "$actual" ".
151 WVSTART "restore --exclude-rx '/foo$' (non-dir, tail anchor)"
152 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
159 WVPASS mkdir src/sub/foo
160 WVPASS touch src/sub/foo/a
161 WVPASS bup index -u src
162 WVPASS bup save --strip -n bupdir src
163 WVPASS bup restore -C buprestore.tmp --exclude-rx '/foo$' /bupdir/latest/
164 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
165 WVPASSEQ "$actual" ".
172 WVSTART "restore --exclude-rx '/foo/$' (dir, tail anchor)"
173 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
180 WVPASS mkdir src/sub/foo
181 WVPASS touch src/sub/foo/a
182 WVPASS bup index -u src
183 WVPASS bup save --strip -n bupdir src
184 WVPASS bup restore -C buprestore.tmp --exclude-rx '/foo/$' /bupdir/latest/
185 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
186 WVPASSEQ "$actual" ".
192 WVSTART "restore --exclude-rx '/foo/.' (dir content)"
193 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
200 WVPASS mkdir src/sub/foo
201 WVPASS touch src/sub/foo/a
202 WVPASS bup index -u src
203 WVPASS bup save --strip -n bupdir src
204 WVPASS bup restore -C buprestore.tmp --exclude-rx '/foo/.' /bupdir/latest/
205 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
206 WVPASSEQ "$actual" ".
214 # bup restore --exclude-rx-from ...
215 # =================================
217 WVSTART "restore --exclude-rx-from"
218 WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
223 WVPASS mkdir src/sub1
224 WVPASS mkdir src/sub2
225 WVPASS touch src/sub1/a
226 WVPASS touch src/sub2/b
227 WVPASS bup index -u src
228 WVPASS bup save --strip -n bupdir src
229 WVPASS echo "^/sub1/" > exclude-rx-file
230 WVPASS bup restore -C buprestore.tmp \
231 --exclude-rx-from exclude-rx-file /bupdir/latest/
232 actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
233 WVPASSEQ "$actual" ".
239 WVPASS rm -rf "$tmpdir"