diff options
| author | David Bremner <david@tethera.net> | 2021-01-10 07:50:14 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-02-06 19:57:55 -0400 |
| commit | f61d88c6f454c368282ac881a864f619a409ba42 (patch) | |
| tree | 428ddda15e9551b3aacdb9426ee7c875ec2e0549 /notmuch-new.c | |
| parent | 0345bc57a0d00d576c0e8bccc23fd448736a4511 (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-new.c')
| -rw-r--r-- | notmuch-new.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/notmuch-new.c b/notmuch-new.c index 0f416939..21e66af1 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -1105,7 +1105,6 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu struct timeval tv_start; int ret = 0; const char *db_path; - char *dot_notmuch_path; struct sigaction action; _filename_node_t *f; int opt_index; @@ -1167,13 +1166,11 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu } if (hooks) { - ret = notmuch_run_hook (db_path, "pre-new"); + ret = notmuch_run_hook (notmuch, "pre-new"); if (ret) return EXIT_FAILURE; } - dot_notmuch_path = talloc_asprintf (notmuch, "%s/%s", db_path, ".notmuch"); - notmuch_exit_if_unmatched_db_uuid (notmuch); if (notmuch_database_get_revision (notmuch, NULL) == 0) { @@ -1212,9 +1209,6 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu action.sa_flags = SA_RESTART; sigaction (SIGINT, &action, NULL); - talloc_free (dot_notmuch_path); - dot_notmuch_path = NULL; - gettimeofday (&add_files_state.tv_start, NULL); add_files_state.removed_files = _filename_list_create (notmuch); @@ -1284,7 +1278,7 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu notmuch_database_close (notmuch); if (hooks && ! ret && ! interrupted) - ret = notmuch_run_hook (db_path, "post-new"); + ret = notmuch_run_hook (notmuch, "post-new"); notmuch_database_destroy (notmuch); |
