X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-new.c;h=223d68bb2530ed7eb1981e3782721d40f99d254b;hb=6967dcbb025280d33c9cd08502de7a5cdb051ae7;hp=0f4169399c0ebc614773d5dddcbce8f8a6e290c2;hpb=0d3bef312dd624225825e6fe175ea8830c1c9e39;p=notmuch diff --git a/notmuch-new.c b/notmuch-new.c index 0f416939..223d68bb 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -673,8 +673,9 @@ add_files (notmuch_database_t *notmuch, char *absolute = talloc_asprintf (state->removed_directories, "%s/%s", path, filename); if (state->debug) - printf ("(D) add_files, pass 2: queuing passed directory %s for deletion from database\n", - absolute); + printf ( + "(D) add_files, pass 2: queuing passed directory %s for deletion from database\n", + absolute); _filename_list_add (state->removed_directories, absolute); } @@ -756,8 +757,9 @@ add_files (notmuch_database_t *notmuch, notmuch_filenames_get (db_subdirs)); if (state->debug) - printf ("(D) add_files, pass 3: queuing leftover directory %s for deletion from database\n", - absolute); + printf ( + "(D) add_files, pass 3: queuing leftover directory %s for deletion from database\n", + absolute); _filename_list_add (state->removed_directories, absolute); @@ -1043,7 +1045,8 @@ print_results (const add_files_state_t *state) } static int -_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) { +_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) +{ if (notmuch_database_needs_upgrade (notmuch)) { time_t now = time (NULL); struct tm *gm_time = gmtime (&now); @@ -1094,7 +1097,8 @@ _maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) { } int -notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[]) +notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, + int argc, char *argv[]) { add_files_state_t add_files_state = { .verbosity = VERBOSITY_NORMAL, @@ -1105,7 +1109,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; @@ -1156,7 +1159,7 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu for (notmuch_config_values_start (add_files_state.new_tags); notmuch_config_values_valid (add_files_state.new_tags); notmuch_config_values_move_to_next (add_files_state.new_tags)) { - const char *tag,*error_msg; + const char *tag, *error_msg; tag = notmuch_config_values_get (add_files_state.new_tags); error_msg = illegal_tag (tag, false); @@ -1167,13 +1170,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 +1213,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); @@ -1239,7 +1237,8 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu if (do_print_progress) { do_print_progress = 0; generic_print_progress ("Cleaned up", "messages", - tv_start, add_files_state.removed_messages + add_files_state.renamed_messages, + tv_start, add_files_state.removed_messages + + add_files_state.renamed_messages, add_files_state.removed_files->count); } } @@ -1284,7 +1283,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);