]> git.notmuchmail.org Git - notmuch/commitdiff
new: Don't lose messages on SIGINT.
authorAustin Clements <amdragon@mit.edu>
Wed, 9 Feb 2011 01:56:31 +0000 (20:56 -0500)
committerDavid Bremner <bremner@debian.org>
Wed, 14 Sep 2011 01:00:15 +0000 (22:00 -0300)
Previously, message removals were always performed, even after a
SIGINT.  As a result, when a message was moved from one folder to
another, a SIGINT between processing the directory the message was
removed from and processing the directory it was added to would result
in notmuch removing that message from the database.

notmuch-new.c

index 7d17793b2f382c5102f092a6e9173966286fa724..b734e5b972373d6b4941b8c711cf99f87056b097 100644 (file)
@@ -868,7 +868,7 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
     removed_files = 0;
     renamed_files = 0;
     gettimeofday (&tv_start, NULL);
     removed_files = 0;
     renamed_files = 0;
     gettimeofday (&tv_start, NULL);
-    for (f = add_files_state.removed_files->head; f; f = f->next) {
+    for (f = add_files_state.removed_files->head; f && !interrupted; f = f->next) {
        status = notmuch_database_remove_message (notmuch, f->filename);
        if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
            renamed_files++;
        status = notmuch_database_remove_message (notmuch, f->filename);
        if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
            renamed_files++;
@@ -883,7 +883,7 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
     }
 
     gettimeofday (&tv_start, NULL);
     }
 
     gettimeofday (&tv_start, NULL);
-    for (f = add_files_state.removed_directories->head, i = 0; f; f = f->next, i++) {
+    for (f = add_files_state.removed_directories->head, i = 0; f && !interrupted; f = f->next, i++) {
        _remove_directory (ctx, notmuch, f->filename,
                           &renamed_files, &removed_files);
        if (do_print_progress) {
        _remove_directory (ctx, notmuch, f->filename,
                           &renamed_files, &removed_files);
        if (do_print_progress) {