]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-new.c
notmuch.Database.remove_message should raise exception on failure
[notmuch] / notmuch-new.c
index 442a2f0ae2886c169881dab4ae9e35bf20f77bec..e5037761c8ee7f1b481f8aa342dddf5865874f65 100644 (file)
@@ -445,7 +445,7 @@ add_files (notmuch_database_t *notmuch,
         */
        if (_entry_in_ignore_list (entry->d_name, state)) {
            if (state->debug)
-               printf ("(D) add_files_recursive, pass 1: explicitly ignoring %s/%s\n",
+               printf ("(D) add_files, pass 1: explicitly ignoring %s/%s\n",
                        path, entry->d_name);
            continue;
        }
@@ -513,9 +513,8 @@ add_files (notmuch_database_t *notmuch,
        /* Ignore files & directories user has configured to be ignored */
        if (_entry_in_ignore_list (entry->d_name, state)) {
            if (state->debug)
-               printf ("(D) add_files_recursive, pass 2: explicitly ignoring %s/%s\n",
-                       path,
-                       entry->d_name);
+               printf ("(D) add_files, pass 2: explicitly ignoring %s/%s\n",
+                       path, entry->d_name);
            continue;
        }
 
@@ -529,7 +528,7 @@ add_files (notmuch_database_t *notmuch,
                                              notmuch_filenames_get (db_files));
 
            if (state->debug)
-               printf ("(D) add_files_recursive, pass 2: queuing passed file %s for deletion from database\n",
+               printf ("(D) add_files, pass 2: queuing passed file %s for deletion from database\n",
                        absolute);
 
            _filename_list_add (state->removed_files, absolute);
@@ -547,7 +546,7 @@ add_files (notmuch_database_t *notmuch,
                char *absolute = talloc_asprintf (state->removed_directories,
                                                  "%s/%s", path, filename);
                if (state->debug)
-                   printf ("(D) add_files_recursive, pass 2: queuing passed directory %s for deletion from database\n",
+                   printf ("(D) add_files, pass 2: queuing passed directory %s for deletion from database\n",
                        absolute);
 
                _filename_list_add (state->removed_directories, absolute);
@@ -618,7 +617,7 @@ add_files (notmuch_database_t *notmuch,
                                          "%s/%s", path,
                                          notmuch_filenames_get (db_files));
        if (state->debug)
-           printf ("(D) add_files_recursive, pass 3: queuing leftover file %s for deletion from database\n",
+           printf ("(D) add_files, pass 3: queuing leftover file %s for deletion from database\n",
                    absolute);
 
        _filename_list_add (state->removed_files, absolute);
@@ -633,7 +632,7 @@ add_files (notmuch_database_t *notmuch,
                                          notmuch_filenames_get (db_subdirs));
 
        if (state->debug)
-           printf ("(D) add_files_recursive, pass 3: queuing leftover directory %s for deletion from database\n",
+           printf ("(D) add_files, pass 3: queuing leftover directory %s for deletion from database\n",
                    absolute);
 
        _filename_list_add (state->removed_directories, absolute);
@@ -878,17 +877,11 @@ _remove_directory (void *ctx,
            goto DONE;
     }
 
-    /*
-     * XXX: The library does not have a function to remove a directory
-     * document for a path. Usually this doesn't matter except for a
-     * slight waste of space. However, if the directory gets added to
-     * the filesystem again, the old directory document is found with
-     * the old mtime. Reset the directory mtime to avoid problems.
-     */
-    notmuch_directory_set_mtime (directory, 0);
+    status = notmuch_directory_delete (directory);
 
   DONE:
-    notmuch_directory_destroy (directory);
+    if (status)
+       notmuch_directory_destroy (directory);
     return status;
 }