aboutsummaryrefslogtreecommitdiff
path: root/notmuch-insert.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-01-10 07:50:14 -0400
committerDavid Bremner <david@tethera.net>2021-02-06 19:57:55 -0400
commitf61d88c6f454c368282ac881a864f619a409ba42 (patch)
tree428ddda15e9551b3aacdb9426ee7c875ec2e0549 /notmuch-insert.c
parent0345bc57a0d00d576c0e8bccc23fd448736a4511 (diff)
CLI: use configured hook directory
This enables support for hooks outside the database directory. It relies strongly on configuration information being usable between closing the database and destroying it.
Diffstat (limited to 'notmuch-insert.c')
-rw-r--r--notmuch-insert.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/notmuch-insert.c b/notmuch-insert.c
index e483b949..0f272e2e 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -481,7 +481,6 @@ notmuch_insert_command (unused(notmuch_config_t *config),notmuch_database_t *not
notmuch_process_shared_options (argv[0]);
- /* XXX TODO replace this use of DATABASE_PATH with something specific to hooks */
db_path = notmuch_config_get (notmuch, NOTMUCH_CONFIG_DATABASE_PATH);
if (! db_path)
@@ -570,7 +569,7 @@ notmuch_insert_command (unused(notmuch_config_t *config),notmuch_database_t *not
status = add_file (notmuch, newpath, tag_ops, synchronize_flags, keep, indexing_cli_choices.opts);
/* Commit changes. */
- close_status = notmuch_database_destroy (notmuch);
+ close_status = notmuch_database_close (notmuch);
if (close_status) {
/* Hold on to the first error, if any. */
if (! status)
@@ -595,9 +594,11 @@ notmuch_insert_command (unused(notmuch_config_t *config),notmuch_database_t *not
if (hooks && status == NOTMUCH_STATUS_SUCCESS) {
/* Ignore hook failures. */
- notmuch_run_hook (db_path, "post-insert");
+ notmuch_run_hook (notmuch, "post-insert");
}
+ notmuch_database_destroy (notmuch);
+
talloc_free (local);
return status_to_exit (status);