]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-new.c
CLI: use configured hook directory
[notmuch] / notmuch-new.c
index 0f4169399c0ebc614773d5dddcbce8f8a6e290c2..21e66af1c55b8d285a1ae9871a88d0e0bac75479 100644 (file)
@@ -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);