X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-new.c;h=3f8b7fcf89840ce13b941132f26599dac002293f;hb=3fa2385f7cc367725ea74a08237158bd5a4163d7;hp=f8fe66a3b153c58e2bb1e0652d97623853cd0576;hpb=2e96464f9705be4ec772280cad71a6c9d5831e6f;p=notmuch diff --git a/notmuch-new.c b/notmuch-new.c index f8fe66a3..3f8b7fcf 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -629,11 +629,28 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) ret = add_files (notmuch, db_path, &add_files_state); for (f = add_files_state.removed_files->head; f; f = f->next) { - printf ("Detected removed file: %s\n", f->filename); + notmuch_database_remove_message (notmuch, f->filename); } for (f = add_files_state.removed_directories->head; f; f = f->next) { - printf ("Detected removed directory: %s\n", f->filename); + notmuch_directory_t *directory; + notmuch_filenames_t *files; + + directory = notmuch_database_get_directory (notmuch, f->filename); + + for (files = notmuch_directory_get_child_files (directory); + notmuch_filenames_has_more (files); + notmuch_filenames_advance (files)) + { + char *absolute; + + absolute = talloc_asprintf (ctx, "%s/%s", f->filename, + notmuch_filenames_get (files)); + notmuch_database_remove_message (notmuch, absolute); + talloc_free (absolute); + } + + notmuch_directory_destroy (directory); } talloc_free (add_files_state.removed_files);