#include <unistd.h>
+#include <libgen.h>
+
#include "database-private.h"
#include "parse-time-vrp.h"
err = stat (hook_dir, &st);
if (err) {
if (errno == ENOENT) {
- const char *database_path = notmuch_database_get_path (notmuch);
- hook_dir = talloc_asprintf (notmuch, "%s/.notmuch/hooks", database_path);
+ char *notmuch_path = dirname (talloc_strdup (notmuch, notmuch->xapian_path));
+ hook_dir = talloc_asprintf (notmuch, "%s/hooks", notmuch_path);
} else {
IGNORE_RESULT (asprintf (message, "Error: Cannot stat %s: %s.\n",
hook_dir, strerror (errno)));
# create maildir structure for notmuch-insert
mkdir -p "$MAIL_DIR"/{cur,new,tmp}
-for config in traditional profile explicit XDG; do
+for config in traditional profile explicit XDG split; do
unset NOTMUCH_PROFILE
notmuch config set database.hook_dir
+ notmuch config set database.path ${MAIL_DIR}
case $config in
traditional)
HOOK_DIR=${MAIL_DIR}/.notmuch/hooks
XDG)
HOOK_DIR=${HOME}/.config/notmuch/default/hooks
;;
+ split)
+ dir="$TMP_DIRECTORY/database.$test_count"
+ notmuch config set database.path $dir
+ notmuch config set database.mail_root $MAIL_DIR
+ HOOK_DIR=${dir}/hooks
+ ;;
esac
test_begin_subtest "pre-new is run [${config}]"