Choose sibling directory of xapian database, as .notmuch may not
exist.
---
lib/open.cc | 6 ++++--
test/T400-hooks.sh | 9 ++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/open.cc b/lib/open.cc
index 1e2a62cd..4324deae 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -1,4 +1,6 @@
#include <unistd.h>
+#include <libgen.h>
+
#include "database-private.h"
#include "parse-time-vrp.h"
@@ -92,8 +94,8 @@ _choose_hook_dir (notmuch_database_t *notmuch,
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)));
diff --git a/test/T400-hooks.sh b/test/T400-hooks.sh
index a3dd4c63..8267d057 100755
--- a/test/T400-hooks.sh
+++ b/test/T400-hooks.sh
@@ -28,9 +28,10 @@ add_message
# 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
@@ -50,6 +51,12 @@ for config in traditional profile explicit XDG; do
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}]"
--
2.30.1
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org