+ MAIL_CORPUS="${TEST_DIRECTORY}/corpus/$mail_subdir"
+ TAG_CORPUS="${TEST_DIRECTORY}/corpus/tags"
+
+ args=()
+ if [ ! -d "$TAG_CORPUS" ] ; then
+ args+=("notmuch-email-corpus/tags")
+ fi
+
+ if [ ! -d "$check_for" ] ; then
+ args+=("notmuch-email-corpus/$mail_subdir")
+ fi
+
+ if [[ ${#args[@]} > 0 ]]; then
+ if command -v pixz > /dev/null; then
+ XZ=pixz
+ else
+ XZ=xz
+ fi
+
+ printf "Unpacking corpus\n"
+ mkdir -p "${TEST_DIRECTORY}/corpus"
+
+ tar --checkpoint=.5000 --extract --strip-components=1 \
+ --directory ${TEST_DIRECTORY}/corpus \
+ --use-compress-program ${XZ} \
+ --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \
+ "${args[@]}"
+
+ printf "\n"
+
+ fi
+
+ cp -lr $TAG_CORPUS $TMP_DIRECTORY/corpus.tags
+ cp -lr $MAIL_CORPUS $MAIL_DIR
+}
+
+notmuch_new_with_cache ()
+{
+ if [ -d $DB_CACHE_DIR ]; then
+ cp -r $DB_CACHE_DIR ${MAIL_DIR}/.notmuch