X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-new.c;h=8214fb23a81b55af1ae00248e25e06bd1e3d003e;hb=986056bdbcfea642a2d08f7ee257f7aaaed433b9;hp=223d68bb2530ed7eb1981e3782721d40f99d254b;hpb=eef21c284742fa5ae14d7d352acc3a4dc98821ce;p=notmuch diff --git a/notmuch-new.c b/notmuch-new.c index 223d68bb..8214fb23 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -1170,9 +1170,19 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu } if (hooks) { + /* Drop write lock to run hook */ + status = notmuch_database_reopen (notmuch, NOTMUCH_DATABASE_MODE_READ_ONLY); + if (print_status_database ("notmuch new", notmuch, status)) + return EXIT_FAILURE; + ret = notmuch_run_hook (notmuch, "pre-new"); if (ret) return EXIT_FAILURE; + + /* acquire write lock again */ + status = notmuch_database_reopen (notmuch, NOTMUCH_DATABASE_MODE_READ_WRITE); + if (print_status_database ("notmuch new", notmuch, status)) + return EXIT_FAILURE; } notmuch_exit_if_unmatched_db_uuid (notmuch);