test -e t/tmp || mkdir t/tmp
TMPDIR="$(test_tmp)" t/test-cat-file.sh
TMPDIR="$(test_tmp)" t/test-compression.sh
+ TMPDIR="$(test_tmp)" t/test-index-clear.sh
TMPDIR="$(test_tmp)" t/test-index-check-device.sh
TMPDIR="$(test_tmp)" t/test-meta.sh
TMPDIR="$(test_tmp)" t/test-restore-map-owner.sh
--- /dev/null
+#!/usr/bin/env bash
+. ./wvtest-bup.sh
+
+set -o pipefail
+
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
+export BUP_DIR="$tmpdir/bup"
+export GIT_DIR="$tmpdir/bup"
+
+bup() { "$top/bup" "$@"; }
+
+
+WVPASS bup init
+WVPASS cd "$tmpdir"
+
+
+WVSTART "index --clear"
+WVPASS mkdir src
+WVPASS touch src/foo src/bar
+WVPASS bup index -u src
+WVPASSEQ "$(bup index -p)" "src/foo
+src/bar
+src/
+./"
+WVPASS rm src/foo
+WVPASS bup index --clear
+WVPASS bup index -u src
+expected="$(WVPASS bup index -p)" || exit $?
+WVPASSEQ "$expected" "src/bar
+src/
+./"
+
+
+WVPASS rm -rf "$tmpdir"
expected="$(echo -e "$pwd_top/\n$tmp_top/" | WVPASS sort)" || exit $?
WVPASSEQ "$actual" "$expected"
) || exit $?
-
-WVSTART "clear-index"
-D=clear-index.tmp
-export BUP_DIR="$TOP/$D/.bup"
-WVPASS force-delete $TOP/$D
-WVPASS mkdir $TOP/$D
-WVPASS bup init
-WVPASS touch $TOP/$D/foo
-WVPASS touch $TOP/$D/bar
-WVPASS bup index -u $D
-WVPASSEQ "$(bup index -p)" "$D/foo
-$D/bar
-$D/
-./"
-WVPASS rm $TOP/$D/foo
-WVPASS bup index --clear
-WVPASS bup index -u $TOP/$D
-expected="$(WVPASS bup index -p)" || exit $?
-WVPASSEQ "$expected" "$D/bar
-$D/
-./"